Suppose I have a time field in excel which I need to use but the field on the webpage wants time in the separate form of hours, minutes and seconds..
Could anyone help regarding this.
hour - dateVariable.ToString(“HH”) if you need it in 24 Hours Format
and dateVariable.ToString(“hh”) if you need it in 12 Hours Format
minutes - dateVariable.ToString(“mm”)
seconds - dateVariable.ToString(“ss”)
Regards,
Dominic
It wasn’t successful
It is a dynamic data not static one, hence this won’t work.
It will work.
check before dateVariable data type must in DateTime else convert the string to datetime convert.ToDateTime(dateVariable)
use the above code.
@ashutoshkhantwal In What format you are getting the input???
Regards,
Arivu
The input is a generic variable, the format is HH:mm:ss.
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
Hey Arivu,Thanks this worked though I used something different in addition to this since the cell was of format custom. Had to format that to a date time variable using format value/assign activity.