I need to convert the WB TimeYmdHms() Into a value with say 5 decimal places to query a MySQL table with timestamps so I can look for timestamps >= my WB time. I tried this (as the TimeDiffSecs is limited to a 60 year lookback)
Decimals(5)
t1=TimeYmdHms()
t2=TimeDiffDays(t1,"1899:12:30:00:00:00")
t3=TimeDiffSecs(t1,ObjectType("DATE",t2))
Message("",t2:@CRLF:t2:".":t3)
My t3 var is about 1 hour off when I put the value into Excel and format as a datetime.
I cannot use MYSQL syntax in this script. I know this is a kludge.
COM Automation's date representation is a little more involved than gluing a couple of integers together. Give the following a try:
Decimals(5)
fDate = ObjectType("R8",ObjectType("DATE",TimeYmdHms()))
I like that, thanks. Saves me from my huge math kludge.
One more thing worth noting. I haven't worked with MySQL since 2005 and most of that code was based on the 2005 WB compiler. Truth be told 2005 is the basis for the majority of the ADO code I have written.
ObjectType() is truly (IMHO) one of the most important functions added to WB. Tony's on-liner only prompts me to dig deeper into what that function can do.
More impressive, in some respects, is that your 2005 code probably worked with few changes in 2015. ;)