Converting for localtime() or gmtime() to time()

Discussion in 'Perl' started by Stephen, May 19, 2004.

  1. Stephen

    Stephen Guest

    Hey all!

    I know that Perl stores the time as the count of the number of seconds
    since Jan 1, 1970. And yeh, there is a function that takes those
    number of seconds and converts them into the 9 different values
    required to get the nice, readable date/time format that we all like
    to see. :)

    However, I'm porting information from one database into another. The
    second database keeps the time values stored as the way Perl stores
    the value, namely the number of seconds since Jan 1, 1970. However,
    the first database has the date/time stored via a timestamp variable.
    I can write a function that converts the time stamp into an array that
    holds the seperate pieces of the timestamp (minutes, hours, seconds,
    am/pm, day, month, and year), however, is there a function that can
    convert this information to the way Perl stores it?

    For example, if I have a timestamp such as May 18th, 2004 8:15PM, I'd
    like to have it converted to 1084925700. Is there such a function out
    there? Or would I have to determine the number of seconds in the year,
    month, day, time given?

    Thanks,
    -Steve
    Stephen, May 19, 2004
    #1
    1. Advertising

  2. Stephen

    Purl Gurl Guest

    Stephen wrote:

    (snipped)

    > For example, if I have a timestamp such as May 18th, 2004 8:15PM, I'd
    > like to have it converted to 1084925700. Is there such a function out
    > there? Or would I have to determine the number of seconds in the year,
    > month, day, time given?



    http://www.purlgurl.net/html/lib/Time/Local.html


    Purl Gurl
    Purl Gurl, May 19, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KW
    Replies:
    1
    Views:
    1,825
    Eric Sosman
    Dec 8, 2004
  2. asit

    time.gmtime

    asit, Jan 25, 2008, in forum: Python
    Replies:
    2
    Views:
    482
    Paul Boddie
    Jan 25, 2008
  3. Leendert Bottelberghs

    time zone offset calc with localtime and gmtime

    Leendert Bottelberghs, Apr 4, 2005, in forum: Perl Misc
    Replies:
    11
    Views:
    770
    Mothra
    Apr 5, 2005
  4. Replies:
    0
    Views:
    114
  5. Replies:
    1
    Views:
    114
    Anssi Saari
    Sep 18, 2013
Loading...

Share This Page