Click here to get back home

Excel Data conversion

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Excel Data conversion Hans Kohls 07-27-2004
Posted by Hans Kohls on July 27, 2004, 2:37 pm
Please log in for more thread options
Hello,

I have to convert the (afaik) Excel (internal) date format into a
different format.
I am wondering if there is a package around to do so. The excel Format
is something like 3NNNN and represents the number of days since 1.1.1900.

Cheers, Hans


Posted by Bill Karwin on July 27, 2004, 11:59 am
Please log in for more thread options
Hans Kohls wrote:
> I have to convert the (afaik) Excel (internal) date format into a
> different format.
> I am wondering if there is a package around to do so. The excel Format
> is something like 3NNNN and represents the number of days since 1.1.1900.

DateTime::Format::Excel is a module intended to do this conversion.

http://search.cpan.org/dist/DateTime-Format-Excel/lib/DateTime/Format/Excel.pm

Regards,
Bill K.


Posted by Joe Smith on July 27, 2004, 7:03 pm
Please log in for more thread options
Hans Kohls wrote:

> Hello,
>
> I have to convert the (afaik) Excel (internal) date format into a
> different format.
> I am wondering if there is a package around to do so. The excel Format
> is something like 3NNNN and represents the number of days since 1.1.1900.

linux% perl -e 'use Date::Calc qw(Add_Delta_Days);
printf "%4d/%02d/%02dn",Add_Delta_Days(1900,1,1,31245)'
1985/07/19

        -Joe


Posted by John McNamara on August 1, 2004, 6:15 pm
Please log in for more thread options
On Tue, 27 Jul 2004 18:03:28 GMT, Joe Smith wrote:

>> Hans Kohls wrote:
>>
>> I have to convert the (afaik) Excel (internal) date format into a
>> different format.
>> I am wondering if there is a package around to do so. The excel Format
>> is something like 3NNNN and represents the number of days since 1.1.1900.

> linux% perl -e 'use Date::Calc qw(Add_Delta_Days);
> printf "%4d/%02d/%02dn",Add_Delta_Days(1900,1,1,31245)'
> 1985/07/19

That is out by 2 days because:

1. the epoch is actually 0 January 1900!
2. 1900 is treated as a leapyear by Excel!!

Mind-boggling stuff is it not.

The following gives the right dates from 1 March 1900 onwards:

... Add_Delta_Days(1899, 12, 30, $excel_date);

John.
--
perl -MCPAN -e 'install jmcnamara & _ x ord $ ;' | tail -1


Similar ThreadsPosted
Help Perl and Excel August 16, 2006, 9:25 am
OLE Excel AutoFilter September 10, 2006, 4:28 pm
Perl and Excel April 6, 2007, 1:06 am
Problem with Name of Excel Chart September 22, 2005, 9:21 am
DBD:Excel on unix machine March 9, 2006, 11:18 am
Everything but the column: win32::OLE Excel fun June 7, 2006, 9:07 pm
Writing row at a time in Excel using OLE June 14, 2007, 1:43 pm
How to write into existing Excel Spreadsheets? July 13, 2004, 1:24 pm
Can I write Macros in excel workbook ? October 8, 2004, 7:50 am
Reading AND writing Excel spreadsheets April 30, 2005, 10:05 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap