Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert number to time
Message
From
14/01/2007 07:59:00
 
 
To
13/01/2007 09:37:44
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01185341
Message ID:
01185433
Views:
10
hi,
thank you for reply,
i think if there another way to prepare this code, i try to solve what i need , i think it will solve my qustion,
CLOSE all
use curbilldata
   m.a=Sec2Str(m1_m)
   m.a1=Sec2Str(m2_m)
   .
   .
   m.a12=Sec2Str(m12_m) 
   ****************************
   m.b=Sec2Str(m1_a)
   m.b1=Sec2Str(m2_a)
   .
   .
   m.b12=Sec2Str(m12_a) 
   ****************************
   m.c=Sec2Str(m1_t)
   m.c1=Sec2Str(m2_t)
   .
   .
   m.c12=Sec2Str(m12_t) 
   ****************************
   m.d=Sec2Str(tot_t)
   m.e=Sec2Str(tot_tot)
   m.f=Sec2Str(tot_per)
   *****************************
   m.g=divi
   m.h=mac1
    

create table newcurbilldata ( m1_a c(20), m2_a c(20),m3_a c(20), m4_a c(20),;
m5_a c(20), m6_a c(20),m7_a c(20), m8_a c(20),m9_a c(20), m10_a c(20),m11_a c(20), m12_a c(20),;
m1_m c(20), m2_m c(20),m3_m c(20), m4_m c(20),m5_m c(20), m6_m c(20),m7_m c(20), m8_m c(20),;
m9_m c(20), m10_m c(20),m11_m c(20), m12,;
m1_t c(20), m2_t c(20),m3_t c(20), m4_t c(20),m5_t c(20), m6_t c(20),m7_t c(20), m8_t c(20),;
m9_t c(20), m10_t c(20),m11_t c(20), m12_t c(20),tot_t c(20),tot_tot c(20),tot_per c(20) ;
 divi c(20),mac1 c(20)

APPEND form  curbilldata to newcurbilldata
GO top
BROWSE
**********************************************************************
newcurbilldata
gcDelimName = ALIAS( ) + '.xls'
gcDelimFile = PUTFILE('excel_file:', gcDelimName, 'xls')
IF EMPTY(gcDelimFile)
   CANCEL
ENDIF
COPY  TO (gcDelimFile) XL5

**************************************************************************
FUNCTION Sec2Str(tnSeconds, llDays)

LOCAL lcHH, lnTm, lcMM, lcSS, lcTime
lnTm = tnSeconds
IF llDays
   lcDD = TRANSFORM(INT(lnTm / 86400), "99") + " "
   lnTm = tnSeconds % 86400
   lcHH = TRANSFORM(INT(lnTm / 3600), "@L 9999")
ELSE   
   lcDD = ""
   lcHH = TRANSFORM(INT(lnTm / 3600), "@L 99999")
ENDIF 
lnTm = lnTm % 3600
lcMM = TRANSFORM(INT(lnTm / 60), "@L 99")
lcSS = TRANSFORM(INT(lnTm % 60), "@L 99")
lcTime = lcDD + lcHH + ":" + lcMM 
*lcTime = lcDD + lcHH + ":" + lcMM + ":" + lcSS
RETURN lcTime
thanks.

>Dates and times in Excel are stored as serial numbers of dates.
>
>For example, 6:00 a.m. of today is stored as 39095.25: 39095 days + 1/4 day since the "reference date" used by Excel (31/Dec/1899).
>
>So, I think you should calculate this number, and then give the cell the corresponding date (or time) format.
>
>For a time, if the date is not of interest, you can use zero point something, e.g., 0.25 for 6:00 a.m. (1/4 of a day since midnight).
>
>>hi all,
>>i try to convert my table have some fields with numbers to excel sheet (convert number to hours and minuts, my report works, but excel sheet not any help
>>
>>
>>.
>>.
>>.
>>REPORT FORM rpt11 PREVIEW &&it works
>>
>>***select curbilldata
>>
>>gcDelimName = ALIAS( ) + '.xls'
>>gcDelimFile = PUTFILE('excel_file:', gcDelimName, 'xls')
>>IF EMPTY(gcDelimFile)
>>   CANCEL
>>ENDIF
>>COPY  TO (gcDelimFile) XL5
>>
>>
>>FUNCTION Sec2Str(tnSeconds, llDays)
>>
>>LOCAL lcHH, lnTm, lcMM, lcSS, lcTime
>>lnTm = tnSeconds
>>IF llDays
>>   lcDD = TRANSFORM(INT(lnTm / 86400), "99") + " "
>>   lnTm = tnSeconds % 86400
>>   lcHH = TRANSFORM(INT(lnTm / 3600), "@L 9999")
>>ELSE
>>   lcDD = ""
>>   lcHH = TRANSFORM(INT(lnTm / 3600), "@L 99999")
>>ENDIF
>>lnTm = lnTm % 3600
>>lcMM = TRANSFORM(INT(lnTm / 60), "@L 99")
>>lcSS = TRANSFORM(INT(lnTm % 60), "@L 99")
>>lcTime = lcDD + lcHH + ":" + lcMM
>>*lcTime = lcDD + lcHH + ":" + lcMM + ":" + lcSS
>>RETURN lcTime
>>
>>thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform