Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Real time converted to Unix time

Reply
Thread Tools

Real time converted to Unix time

 
 
Brian
Guest
Posts: n/a
 
      08-29-2003
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.
 
Reply With Quote
 
 
 
 
James Willmore
Guest
Posts: n/a
 
      08-29-2003
On 28 Aug 2003 17:04:36 -0700
http://www.velocityreviews.com/forums/(E-Mail Removed) (Brian) wrote:
> 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

--
Jim
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Open source is a real phenomenon, but it doesn't require unix variants. Avengerę Computer Support 13 02-05-2005 05:54 AM
compile C programs with UNIX system calls (= Unix Programs??) jrefactors@hotmail.com C Programming 18 01-10-2005 03:35 AM
compile C programs with UNIX system calls (= Unix Programs??) jrefactors@hotmail.com C++ 12 01-10-2005 03:35 AM
product of real and (integer)(after converted to real one) value - vhdl found fatal error senthil VHDL 5 01-24-2004 04:37 AM
my own perl "dos->unix"/"unix->dos" Robert Wallace Perl Misc 7 01-22-2004 10:59 PM



Advertisments