Posted: Sat Aug 01, 2009 3:33 am
You will need to declare your Timestamp column with the extended attribute of "microseconds" in order to store fraction seconds.
A short text to describe your forum
http://dsxchange.com./
Code: Select all
FUNCTION NowMS(Format)
$COPYRIGHT "Copyright (c) 2004, Ray Wurlod. All rights reserved. May be freely used with this copyright notice intact."
$OPTIONS TIME.MILLISECOND
Equate DP To "." ; * change for different locale
Now = System(12) ; * internal format
Time = Time()
If Time = Now
Then
MS = "000" ; * milliseconds not supported
End
Else
MS = Mod(Now,1000) ; * milliseconds portion of time
End
Begin Case
Case UnAssigned(Format) Or IsNull(Format)
Ans = @NULL
Case Format = 0 ; * internal format
Ans = Now/1000
Case Format = 1 ; * time format (HH:MM:SS.sss)
Ans = Oconv(Now/1000, "MTS") : DP : MS
Case Format = 2 ; * timestamp format using today's date
Ans = Oconv(Date(), "D-YMD[4,2,2]") : " " : Oconv(Now/1000, "MTS") : DP : MS
Case @TRUE
Ans = @NULL
Call DSTransformError("Invalid format argument.", "NowMS")
End Case
RETURN(Ans)