CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
DATETIME in excel

 



bert.baeck
New User

Feb 3, 2007, 3:22 AM

Post #1 of 8 (8384 views)
DATETIME in excel Can't Post

Hello,

I installed the datetime::format::excel and I can get my date out of a Excel field!!!

yyyy:mm:dd hh.mm.ss

But that's not ok! I also need my time information!!! Anybody knows how I can get that information out of Excel so I can send it to Mysql database?

This would realllllllllllllly help me!!!! I'm on a deathline ;-)

Thanks,

Bert from Belgium


KevinR
Veteran


Feb 3, 2007, 10:52 AM

Post #2 of 8 (8382 views)
Re: [bert.baeck] DATETIME in excel [In reply to] Can't Post


Quote
hh.mm.ss


is that not the time informaton?
-------------------------------------------------


bert.baeck
New User

Feb 3, 2007, 11:16 AM

Post #3 of 8 (8380 views)
Re: [bert.baeck] DATETIME in excel [In reply to] Can't Post

No that's not the information... When you read something out of Excel, you get a unique number!!! This 1 number is the whole information DATE AND TIME


KevinR
Veteran


Feb 3, 2007, 11:44 AM

Post #4 of 8 (8379 views)
Re: [bert.baeck] DATETIME in excel [In reply to] Can't Post

but is that the correct time information (hh.mm.ss) you are looking to send to your mysql database even if the date is in front of it? You could split that on the space and make two variables out of it.
-------------------------------------------------


bert.baeck
New User

Feb 4, 2007, 12:14 AM

Post #5 of 8 (8374 views)
Re: [KevinR] DATETIME in excel [In reply to] Can't Post

I explain a little bit further...

I have a field in Excel with datetime ex. "2007/12/23 23:12:11" Once it is a variable in Perl it's a
unique number 208962,121320000. This contains every information. There is a function: datetime:format:Excel which gives me the date!!! That's fine so i can write it to MySql!! But an other
field in Excel is the time but... I don't know how to get that...

Bert


ProBulletin
Novice

Feb 4, 2007, 3:10 AM

Post #6 of 8 (8372 views)
Re: [bert.baeck] DATETIME in excel [In reply to] Can't Post


Quote
Once it is a variable in Perl it's a
unique number 208962,121320000.


A unique number...what do you mean?

Is it the seconds since epoch?...if so you can get the time.


Regards,
Paul Wilson
ProBulletin Board: http://www.probulletin.com/


KevinR
Veteran


Feb 4, 2007, 11:41 AM

Post #7 of 8 (8369 views)
Re: [ProBulletin] DATETIME in excel [In reply to] Can't Post

I'm confused too Crazy
-------------------------------------------------


davorg
Thaumaturge / Moderator

Feb 5, 2007, 7:23 AM

Post #8 of 8 (8366 views)
Re: [bert.baeck] DATETIME in excel [In reply to] Can't Post

Excel stores dates and times as a floating point number. The integer is the number of days since Jan 1st 1900 and the decimal part is a fraction of a day (.0 is midnight, .5 is noon, etc).

DateTime::Format::Excel takes a number in this format and converts it to a Perl DateTime object. Once you have the DateTime object you can use any of its methods to get the date and time in whatever format you like.

The documentation for DateTime::Format::Excel has an example that uses the "ymd" method to get the date. But you can also use the hms method to get the time. Or any of the other myriad methods of the DateTime object.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives