GetExcelRange and time

GetExcelRange and time

Postby Maurizio » Mon Jan 15, 2018 5:15 pm

Hello Rao ,

I use GetExcelRange to import from Excel .
When in Excel I have a column format time ex : 08:50:00
GetExcelRange returns 0.33

Thanks in anticipations
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

Re: GetExcelRange and time

Postby Silvio.Falconi » Tue Jan 16, 2018 9:55 am

do you tried to converte in text format ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: GetExcelRange and time

Postby Silvio.Falconi » Tue Jan 16, 2018 9:59 am

I tried and run ok
Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: GetExcelRange and time

Postby nageswaragunupudi » Tue Jan 16, 2018 2:11 pm

Mr Silvio

You stored the values in Excel in text format. So the same text values are read from the range and you do not see any difference. But storing Dates, DateTime values and Time valeus as Text in Excel is not the best practice because these values cannot be used for computations.

Mr. Maurizio has stored the time values in Time format.

Mr. Maurizio

Excel internally stores Dates, DateTime values and Time values as double precision numbers and displays in the required format after conversion.

So the time "08:50:00" is stored as a fraction of day, i.e., ( 8 * 3600 + 50 * 60 ) / 86400 = 0.3680555...
When our program reads the data from Excel, it reads the value as number. We need to convert it back to time format for storage or display in Harbour.
You can do this by
SECTOTIME( nValue * 24 * 3600 ) where nValue is the value read by our program.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10663
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: GetExcelRange and time

Postby Maurizio » Tue Jan 16, 2018 3:04 pm

Thank Rao ,
works perfectly :lol:

Maurizio
www.nipeservice.com
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 54 guests