strict!
[kivitendo-erp.git] / SL / Helper / DateTime.pm
1 package DateTime;
2
3 use strict;
4
5 sub now_local {
6   return shift->now(time_zone => $::locale->get_local_time_zone);
7 }
8
9 sub today_local {
10   return shift->now(time_zone => $::locale->get_local_time_zone)->truncate(to => 'day');
11 }
12
13 sub to_lxoffice {
14   return $::locale->format_date(\%::myconfig, $_[0]);
15 }
16
17 sub from_lxoffice {
18   return $::locale->parse_date_to_object(\%::myconfig, $_[1]);
19 }
20
21 1;
22
23 __END__
24
25 =encoding utf8
26
27 =head1 NAME
28
29 SL::Helpers::DateTime - helper functions for L<DateTime>
30
31 =head1 FUNCTIONS
32
33 =over 4
34
35 =item C<now_local>
36
37 Returns the current time with the time zone set to the local time zone.
38
39 =item C<today_local>
40
41 Returns the current date with the time zone set to the local time zone.
42
43 =item C<to_lxoffice>
44
45 Formats the date according to the current Lx-Office user's date
46 format.
47
48 =item C<from_lxoffice>
49
50 Parses a date string formatted in the current Lx-Office user's date
51 format and returns an instance of L<DateTime>.
52
53 =back
54
55 =head1 AUTHOR
56
57 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
58
59 =cut