How to extract Hours,minutes,seconds from a date

If you are getting HH:mm:ss format then split the value using :
and get the hour,min,sec
For Example ->Generic Variable → GvDateTime (11:15:00)
create splittime variable and datatype->string
assign splittime=GvDateTime.ToString().Split(":")

Hour- >splittime(0) ---->11
Min- >splittime(1)------->15
Sec- >splittime(2)------->00

the other way is you need to convert hh:mm:ss into time then get the values.
string userInput = “15:43:13”
create TimeSpan varible ->timeval
assign timeval=TimeSpan.Parse(userInput)
timeval.hours.Tosting ->hour
timeval.Minutes.Tosting ->min
timeval.Seconds.Tosting → sec

Regards,
Arivu

5 Likes