8 Einträge, 1 Seite |
my $datum = ((localtime())[5]+1900) . '-' . ((localtime())[4]+1) . '-' . ((localtime())[3]);
1 2 3 4 5 6 7 8 9
my $datum = get_date(); sub get_date { my ($dd, $mm, $yy ) = ( localtime() )[3..5]; $yy += 1900; $mm += 1; return sprintf( "%04d-%02d-%02d", $yy, $mm, $dd ); }
1 2 3 4 5 6 7 8 9
#!/usr/bin/perl use strict; use warnings; use Time::localtime; use DateTime; printf "%02d-%02d-%04d\n", localtime->mday, localtime->mon + 1, localtime->year + 1900; print DateTime->today->dmy('-'), "\n"; print DateTime->new(day => 31, month => 12, year => 2007)->dmy('-'), "\n";
use POSIX qw(strftime);
sid burn+2007-09-19 12:41:26--Hier hast du doch auch die oben erwähnte Race condition...Code (perl): (dl )printf "%02d-%02d-%04d\n", localtime->mday, localtime->mon + 1, localtime->year + 1900;
QuoteGegen POSIX spricht eher das das Modul so unheimlich groß ist.
8 Einträge, 1 Seite |