1:00 PM(PDT)
Above is time format stored in string variable and i want to append 0 in start of time like 01:00 PM(PDT).
Trying different things but no use.
1:00 PM(PDT)
Above is time format stored in string variable and i want to append 0 in start of time like 01:00 PM(PDT).
Trying different things but no use.
Try this:
Assign
InputTime = “1:00 PM(PDT)”
Assign
FormattedTime = DateTime.ParseExact(InputTime, “h:mm tt’(PDT)'”, CultureInfo.InvariantCulture).ToString(“hh:mm tt’(PDT)'”)
Hope this helps,
Best Regards.
I already deleted PDT its not in use and i tried your solution it showing cultureinfo is not declared.
Since you said you have stored it in a string variable, try concatenation:
“0”+stringVar
Hope this helps,
Best Regards.
Try this
If(Str.Split({":"},2,StringSplitOptions.None)(0).Length=2,"","0") + Str.Split({":"},2,StringSplitOptions.None)(0) + ":" + Str.Split({":"},2,StringSplitOptions.None)(1)
Cheers
You shouldn’t deal with datetimes as strings by doing all this splitting. Convert them to proper datetime then output the format you need.
Give a try with the following
DateTime.ParseExact(strInput, "h:mm tt'(PDT)'", System.Globalization.CultureInfo.InvariantCulture).ToString("hh:mm tt'(PDT)'")
Regards
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.