Ooo. I've never used this. It sure looks better than parsing the date out yourself.
Peter C. -----Original Message----- From: Hanson, Robert [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 10:21 AM To: Roy Peters Cc: [EMAIL PROTECTED] Subject: RE: time function You could also use the Date::Parse module, part of the TimeDate package... use Date::Parse; my $epoch = str2time('1/17/2002 11:15 AM'); Rob -----Original Message----- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 12:57 PM To: Roy Peters Cc: [EMAIL PROTECTED] Subject: Re: time function On Jan 16, Roy Peters said: >I need someone to tell me the function that will convert time in this >format to epoch time: 1/17/2002 11:15 AM If localtime() isn't good enough for you, then perhaps you'll want to use the POSIX strftime() function, or you could hand-roll a solution. my ($min, $hr, $day, $mon, $year) = (localtime)[1..5]; my $date = sprintf( "%d/%d/%d %d:%d %s", # format string $mon + 1, $day, $year + 1900, # date (($hr - 1) % 12 + 1), $min, # time $hr < 12 ? "AM" : "PM" # mode ); -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]