Home  |  Linux  | Mysql  | PHP  | XML
From:reader@newsguy.com Date:Mon May 12 18:21:44 2008
Subject: Re: Date::Manip
Rob Dixon <rob.dixon@350.com> writes:

>> What is the right syntax?
>
>   print $date = ParseDate("epoch 1210628919") . "\n";

Egad, and there is a big NOTE in perldoc Date::Manip about that very
thing... thanks for you patience

For anyone finding these posts with  a search:
 (From perldoc Date::Manip)

           NOTE:  One of the most frequently asked questions that I
           have gotten is how to parse seconds since the epoch.
           ParseDateString
           cannot simply parse a number as the seconds since the epoch
           (it conflicts with some ISO-8601 date formats).  There are
           two ways
           to get this information.  First, you can do the following:

               $secs = ...         # seconds since Jan 1, 1970
               00:00:00 GMT
               $date = DateCalc("Jan 1, 1970  00:00:00 GMT","+
               $secs");

           Second, you can call it directly as:

               $date = ParseDateString("epoch $secs");


Navigate in group perl.beginners at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants