简体   繁体   中英

Issues reading Time value in Perl using win32:OLE

I am trying to read an Excel in Perl which have values in format --> "12:21:33 PM"

I need to Compare the Values of two cells and then need to sort them our accordingly. But the issue is that when i tried to read the values and checked (by using Printf) some decimal values in form of .444432323232 is displayed and due to this i am unable to compare two values of time.

Plz suggest

This is excel. The data and the display text are different. Datetime in excel stored as a real.

"Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 AM" is represented by the number 36892.521."

Check these how to handle time in excel:

http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.37/lib/Spreadsheet/WriteExcel.pm#DATES_AND_TIME_IN_EXCEL

And check this module too: http://search.cpan.org/~aburs/DateTime-Format-Excel-0.31/lib/DateTime/Format/Excel.pm

regards,

To retrieve the formatted value of a cell you should use the {'Text'} property instead of the {'Value'} property:

http://docs.activestate.com/activeperl/5.8/faq/Windows/ActivePerl-Winfaq12.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM