Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Output hours exceeding 23 with a DateTime variable
#1
I wonder whether there exists a simple way to output a DateTime variable in the form hhh:mmConfuseds where hhh the hours part which it may exceed the limit of 23.

I attach herewith my approach

Many thanks in advance.

Macro temp05
Code:
Copy      Help
str s6="19:59:00"
str s="08:14:00"
DateTime x sx

x.AddStr(s6)
x.AddStr(s)

int day hour minu sec
x.GetParts(0 0 day hour minu sec)
hour=day*24+hour
outt F"{hour%%04i}:{minu%%02i}:{sec%%02i}"
#2
Probably nothing shorter/better exists.
#3
error if
rep(60) x.AddStr("23:55:55")

TimeSpanGetParts can get total days without month/year.

Macro Macro2754
Code:
Copy      Help
str s6="19:59:00"
str s="08:14:00"
DateTime x sx

x.AddStr(s6)
x.AddStr(s)
rep(12*30) x.AddStr("23:55:55") ;;add more than month

int day hour minu sec
DateTime.TimeSpanGetParts(x day hour minu sec)
hour=day*24+hour
outt F"{hour%%04i}:{minu%%02i}:{sec%%02i}"


Forum Jump:


Users browsing this thread: 1 Guest(s)