oikool has asked for the wisdom of the Perl Monks concerning the following question:
here im extracting the month and year, how can i convert this to unix time stamp of say (20th feb 2014, 23:59:00). Is there any inbuilt function.... to convert it
#!/usr/bin/env perl -l use strict; use warnings; use Time::Piece; my $t = localtime($^T); print "\n"; print 'entire time: ', $t; print "\n"; print 'Month: ', $t->month; print "\n"; print 'Year: ', $t->year; ##### here in this below code, im trying to change ## unix timestamp of IST ## timezone to get this particular date ##20th FEB 2014 , 23:59:00 use strict; use warnings; use DateTime::Format::HTTP; my $date = 'Mon, Feb 3 04:00:00 GMT 2003'; my $dt_class = 'DateTime::Format::HTTP'; my $dt = $dt_class->parse_datetime($date); print $dt_class->format_datetime($dt);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: convert it to unix time stamp
by karlgoethebier (Abbot) on Feb 21, 2014 at 08:20 UTC | |
|
Re: convert it to unix time stamp
by Anonymous Monk on Feb 21, 2014 at 08:16 UTC | |
by oikool (Novice) on Feb 21, 2014 at 09:35 UTC | |
by sn1987a (Curate) on Feb 21, 2014 at 12:53 UTC | |
by Bloodnok (Vicar) on Feb 21, 2014 at 12:06 UTC | |
by Not_a_Number (Prior) on Feb 21, 2014 at 20:06 UTC | |
by Anonymous Monk on Feb 21, 2014 at 17:33 UTC |