ITmajor has asked for the wisdom of the Perl Monks concerning the following question:

I have been given text files that put the time & date like this 39548.20812. I can go into excel and change the format so that it looks like this 080410 04:59:42:42 (yymmdd hh:mm:ss:ss format) How can I write a program that will convert the time into the time & date into the yymmdd hh:mm:ss:ss format? I don't know what kind of format the first time/date is in so I'm having trouble getting started.

Replies are listed 'Best First'.
Re: Changing time & date format
by moritz (Cardinal) on Jul 07, 2008 at 20:27 UTC
Re: Changing time & date format
by philipbailey (Curate) on Jul 07, 2008 at 20:39 UTC
    I believe that the date format is the number of days since 1st January 1900. Some versions of Excel (for Macs, for instance) may use days since the start of 1904, so you need to know the source of your text file.
Re: Changing time & date format
by regexes (Hermit) on Jul 08, 2008 at 07:57 UTC
    Hello,

    Don't know if will help you with this specific issue, however, something to investigate when dealing with date/time formats is DateTime

    regexes


    -------------------------
    Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan "press on" has solved and always will solve the problems of the human race.
    -- Calvin Coolidge, 30th President of the USA.