Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Better date/time functions (for QM < 2.3.2)
#4
I have this function...

Code:
Copy      Help
str sLength="800.32"

ARRAY(str) arr
int i nt
nt = tok(sLength arr 2 ".")
str MS.from("." arr[1])
err
,MS.from(".")
double iMS=val(MS 2);err
MS.format("%.03f" iMS)
MS.remove(0 1)

int Length=val(sLength 2)
if Length>86400
,ret
int Hours=Length/3600
int Minutes=(Length-(Hours*3600))/60
int Seconds=(Length-(Hours*3600)-(Minutes*60))
str HMS.from(Hours ":" Minutes ":" Seconds MS)
DateTime x
x.FromStr(HMS)
sLength=x.ToStrFormat("{HH}:{mm}:{ss}.{F}")
out sLength

I would like to use it as a member function for a string variable so I can call it like:
str Length.GetDateTime("800.32")

or better yet...
A member function of DateTime...
str Length="800.32"
DateTime x.SecondsToDateTime(Length)

Thanks,
Jimmy Vig


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)