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