Skip to content
Snippets Groups Projects
Commit b371cbb6 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

added more timestamp functions

parent 73d29319
Branches
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ use vars qw(@ISA @EXPORT);
require Exporter;
@ISA= qw(Exporter);
@EXPORT= qw(ts ts_date ts_ISO ts_ISO2_gmt ts_pg);
@EXPORT= qw(ts ts_date ts_ISO ts_ISO_gmt ts_ISO2_gmt ts_pg);
sub ts
{
......@@ -25,6 +25,13 @@ sub ts_date
sprintf ("%4d-%02d-%02d", $ts[5]+1900, $ts[4]+1, $ts[3]);
}
sub ts_gmdate
{
my $time= shift || time ();
my @ts= gmtime ($time);
sprintf ("%4d-%02d-%02d", $ts[5]+1900, $ts[4]+1, $ts[3]);
}
sub ts_ISO
{
my $time= shift || time ();
......@@ -41,6 +48,14 @@ sub ts_ISO2_gmt
$ts[5]+1900, $ts[4]+1, $ts[3], $ts[2], $ts[1], $ts[0]);
}
sub ts_ISO3_gmt
{
my $time= shift || time ();
my @ts= gmtime ($time);
sprintf ("%04d-%02d-%02dT%02d:%02d:%02dZ",
$ts[5]+1900, $ts[4]+1, $ts[3], $ts[2], $ts[1], $ts[0]);
}
sub ts_ISO_gmt
{
my $time= shift || time ();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment