Re: Date to seconds

2003-09-17 Thread Rob Dixon

Kit-Wing Li wrote:
>
> Does anybody know of a quick method in perl to turn a date string into its
> equivalent in seconds, include milliseconds if possible?  Ex: 20030910
> 13:50:25.6 to 1063202644.  Thanks much!

The Date::Manip module will do it for you easily, as long as you're
not worried about size or performance. See below.

HTH,

Rob


use strict;
use warnings;

use Date::Manip;

my $date = ParseDate('20030910 13:50:25.6');
my $seconds = UnixDate($date, '%s');

print $seconds, "\n";

** OUTPUT **

1063230625






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Date to seconds

2003-09-11 Thread Alexander Blüm
Li, Kit-Wing wrote:
Hi,

Does anybody know of a quick method in perl to turn a date string into its
equivalent in seconds, include milliseconds if possible?  
> Ex: 20030910 13:50:25.6 to 1063202644.  Thanks much!

starting when?
I mean, you 1063202644 seconds, and these are
33years : 37weeks : 01day : 14hours : 04minutes : 04seconds

oooh... since 1970 00:00:00

try "print time()";

if you want to convert any other date to seconds since 1970, you will 
have to convert the year, month and day seperately to seconds, don't 
forget, the hours and minutes...

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Date to seconds

2003-09-11 Thread Li, Kit-Wing
Hi,

Does anybody know of a quick method in perl to turn a date string into its
equivalent in seconds, include milliseconds if possible?  Ex: 20030910
13:50:25.6 to 1063202644.  Thanks much!



--
This message is intended only for the personal and confidential use of the
designated recipient(s) named above.  If you are not the intended recipient of
this message you are hereby notified that any review, dissemination,
distribution or copying of this message is strictly prohibited.  This
communication is for information purposes only and should not be regarded as
an offer to sell or as a solicitation of an offer to buy any financial
product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be
secure or error-free.  Therefore, we do not represent that this information is
complete or accurate and it should not be relied upon as such.  All
information is subject to change without notice.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]