in reply to Re^4: Date question
in thread Date question
You could use the str2time() / time2str() functions instead (which are exported by default, btw).
my $date = "2008-10-29"; my $http_date = time2str( str2time($date) ); # Tue, 28 Oct 2008 23:0 +0:00 GMT
You can also explicitly specify the time zone with str2time(), e.g.
str2time("2008-10-29", "GMT") # --> Wed, 29 Oct 2008 00:00:00 GMT str2time("2008-10-29", "-0800") # --> Wed, 29 Oct 2008 08:00:00 GMT str2time("2008-10-29", "+0100") # --> Tue, 28 Oct 2008 23:00:00 GMT
(As to your off-by-one day problem, I'm not really sure I understand what you mean, so I can't comment on that...)
|
|---|