views:

15

answers:

1

Hi, Thanks for viewing my question.

This is basicaly excel I am working on

**Shift Start Time  Break 1 Time    Lunch Time  Break 2 Time    Shift End Time**
     7:00:00      8:30:00            12:00:00         14:30:00         16:30:00

when I am convertiong this excel to XML from my .Net code the time values in Xcl are getting converted to text so the data is getting currupt.

Shift_x0020_Start_x0020_Time=''0.291666666666667''  
Break_x0020_1_x0020_Time=''0.354166666666667'' 
Lunch_x0020_Time=''0.5'' 
Break_x0020_2_x0020_Time=''0.604166666666667'' 
Shift_x0020_End_x0020_Time=''0.6875''

This is how the XML generated looks. I dont want this to happen and I want to hold the actual time values entred by user. Kindly suggest what to do.

A: 

Dates are stored as numbers in Excel, with time of day as a decimal fraction. Thus 12 Noon is exactly 0.5 (half a day). You must convert the fractions to hours:minutes:seconds yourself in your .net code before writing the XML.

n is the number given to you by Excel

h       = n*24
hours   = floor(h)
m       = (h-hours) * 60
minutes = floor(m)
seconds = floor((m-minutes) * 60)
Jim Garrison