X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/2cf0bf46e2d6372ad8402d73e2ab1e7cc59b122e..51c64daf815a9b58dbe35f8d3a9daf3f08c0d1e5:/SL/Helper/DateTime.pm diff --git a/SL/Helper/DateTime.pm b/SL/Helper/DateTime.pm new file mode 100644 index 000000000..fa035ebfe --- /dev/null +++ b/SL/Helper/DateTime.pm @@ -0,0 +1,57 @@ +package DateTime; + +sub now_local { + return shift->now(time_zone => $::locale->get_local_time_zone); +} + +sub today_local { + return shift->now(time_zone => $::locale->get_local_time_zone)->truncate(to => 'day'); +} + +sub to_lxoffice { + return $::locale->format_date(\%::myconfig, $_[0]); +} + +sub from_lxoffice { + return $::locale->parse_date_to_object(\%::myconfig, $_[1]); +} + +1; + +__END__ + +=encoding utf8 + +=head1 NAME + +SL::Helpers::DateTime - helper functions for L + +=head1 FUNCTIONS + +=over 4 + +=item C + +Returns the current time with the time zone set to the local time zone. + +=item C + +Returns the current date with the time zone set to the local time zone. + +=item C + +Formats the date according to the current Lx-Office user's date +format. + +=item C + +Parses a date string formatted in the current Lx-Office user's date +format and returns an instance of L. + +=back + +=head1 AUTHOR + +Moritz Bunkus Em.bunkus@linet-services.deE + +=cut