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
@ashutoshkhantwal, Where do you find it hard ?
Regards,
Dominic
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.