I know you'll all tell me how bad this is but unfortunately i have inherited it and for the time being i cannot change it but here goes...
we have a system that populates access databases, these are then pulled into a SQl table, no probs so far.
within this table there is one field for holding a date and several fields with time values. The original systems stored these times as text so when they are pulled into SQl and converted to a date/time they have had a 'default' date added (1899-12-30). i now have to work with these fields and caluclate the differences between times, which doesn't seem like a problem apart from where the 2 times span midnight.
So the difference between 1899-12-30 22:00:00.000 and 22:30:00.000 would be 30 minutes, but the difference between 1899-12-30 23:45:00:.000 and 18-12-30 00:15:00.000 is 23 hours 30 and not 30 minutes which it MAY be depending on the date stored in the date field.
Can anyone think of a workaround for this?
Cheers, Craig
Si fractum non sit, noli id reficere
we have a system that populates access databases, these are then pulled into a SQl table, no probs so far.
within this table there is one field for holding a date and several fields with time values. The original systems stored these times as text so when they are pulled into SQl and converted to a date/time they have had a 'default' date added (1899-12-30). i now have to work with these fields and caluclate the differences between times, which doesn't seem like a problem apart from where the 2 times span midnight.
So the difference between 1899-12-30 22:00:00.000 and 22:30:00.000 would be 30 minutes, but the difference between 1899-12-30 23:45:00:.000 and 18-12-30 00:15:00.000 is 23 hours 30 and not 30 minutes which it MAY be depending on the date stored in the date field.
Can anyone think of a workaround for this?
Cheers, Craig
Si fractum non sit, noli id reficere