Real time converted to Unix time

B

Brian

I have seen many request to go from unix to GM time, but I have not
seen the reverse. Anyone know what the formula would be to convert a
US standard date format to unix time. The variable is something like
08282003 for August 28th 2003. I was thinking that I take each set of
numbers and multiply them by the number of seconds in that set. for
example
Each day = 86400 seconds - so for the above example, 2419200 seconds
in 28 days.
Each month... well - thats the mystery.
Each year 31536000 seconds. But I think I am doing this wrong. Plus,
there is probably a module out there that does it for me.

Any and all help is very appreciated.
 
J

James Willmore

On 28 Aug 2003 17:04:36 -0700
I have seen many request to go from unix to GM time, but I have not
seen the reverse. Anyone know what the formula would be to convert
a US standard date format to unix time. The variable is something
like 08282003 for August 28th 2003. I was thinking that I take each
set of numbers and multiply them by the number of seconds in that
set. for example
Each day = 86400 seconds - so for the above example, 2419200 seconds
in 28 days.
Each month... well - thats the mystery.
Each year 31536000 seconds. But I think I am doing this wrong.
Plus, there is probably a module out there that does it for me.

Any and all help is very appreciated.

There are several modules on CPAN that can convert time from one
format to another. Plus, there are several time function built into
Perl.

Start with the documentation. The shell-ish way to convert and
manipulate time is not a requirement in Perl - others have done the
work for you.

HTH
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,293
Messages
2,571,505
Members
48,192
Latest member
LinwoodFol

Latest Threads

Top