Dear all

In converting over a timesheets application from Access to MSSQL I am
having difficulty with datetime fields:  consider the following (in
CF5):

<CFSET t1 = createtime("00","00","00")>
output: {ts '1899-12-30 00:00:00'}
<CFSET t2 = createtime("12","00","00")>
output: {ts '1899-12-30 12:00:00'}
<CFSET t3 = createtime("00","30","00")>
output: {ts '1899-12-30 00:30:00'}
<CFSET t4 = t1 + t2>
output: 0.5
<CFSET t4a = t2 + t3>
output: 0.520833333333
<CFSET t4b = createodbctime(t2 + t3)>
output: {t '12:30:00'}
<CFSET t4c = createodbcdatetime(t2 + t3)>
output: {ts '1899-12-30 12:30:00'}

The values above are all saved to a MSSQL DB in datetime fields, this is
the output:

t1: 1899-12-30 00:00:00
t2: 1899-12-30 12:00:00
t3: 1899-12-30 00:30:00
t4: 1900-01-01 12:00:00
t4a: 1900-01-01 12:29:59
t4b: 2004-09-19 12:30:00
t4c: 1899-12-30 12:30:00

As you can see, there are various inconsistencies here which will make
further calculations dangerous and/or tricky (summaries etc) and also
might produce different results if / when we upgrade CF.

In fact all I am interested in are the hh:mm, I was wondering what other
people do when recording and calculating time...  

Thanks

--
Regards;

Richard Meredith-Hardy
-------------------------------------------------------------
r[dot]mh[at]flymicro[dot]com
Tel: + 44 (0)1462 834776 FAX: + 44 (0)1462 732668
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to