Convert Clarion Standard Time to SQL Time

sql
Tags: #<Tag:0x00007f46db041978>

#1

If you have an INT data type in your SQL database that hold a Clarion Time value you can convert it to SQL Time using this snippet:
select convert(time, dateadd(ms, (ClarionTimeField-1)*10,0))
or to get a text format time string
select convert(varchar, dateadd(ms, (ClarionTimeField-1)*10,0),114)

DateAdd with ms means milliseconds. Clarion time is the number of hundreds of seconds since midnight + 1. Multiplying by 10 gets you to milliseconds and then you can convert to the data type you want.

HTH,
Rick


#2

Thanks Rick!
Just noting this topic as related: