Hi Team,
I Have to convert date time into specific format, Please help
IP: 13 Jul 2023 8:33:52 AM GMT -05.00
12 Jul 2023 8:33:52 AM GMT -05.00
11 Jul 2023 8:33:52 AM GMT -05.00
OP: 13 Jul 2023 8:33:52
12 Jul 2023 8:33:52
11 Jul 2023 8:33:52
Regards,
Manoj.
Vikas_M
(Vikas M)
2
Hey @manojmanu.rpa
To remove GMT use below code
currentDateTime = currentDateTime.Replace(" GMT -05.00", "")
and to get in required format use below code
DateTime.ParseExact(currentDateTime, "dd MMM yyyy h:mm:ss tt", CultureInfo.InvariantCulture)
supriya117
(Supriya Allada)
4
Hi @manojmanu.rpa
Try this:
ParsedDateTime = DateTime.ParseExact(InputDateTimeStr, "dd MMM yyyy h:mm:ss tt 'GMT' zzz", System.Globalization.CultureInfo.InvariantCulture).ToString("dd MMM yyyy h:mm:ss")
Parvathy
(PS Parvathy)
5
Hi @manojmanu.rpa
- Use this syntax in Assign activity
strinput(Datatype: Array(of String))= {"13 Jul 2023 8:33:52 AM GMT -05:00", "12 Jul 2023 8:33:52 AM GMT -05:00", "11 Jul 2023 8:33:52 AM GMT -05:00"}
- Run a For Each loop to iterate through above input
- Use Assign activity and give below syntax:
var_datetime(Datatype:System.Datetime)= DateTime.ParseExact(currentItem.ToString, "d MMM yyyy H:mm:ss tt 'GMT' zzz", System.Globalization.CultureInfo.InvariantCulture)
- Use assign activtiy and give below syntax:
output_date(Datatype: System.String)=var_datetime.ToString("dd MMM yyyy h:mm:ss ")
- Print it in Write Line.
Note: Shared the workflow for reference
Sequence3.xaml (8.5 KB)
Output:
As per the input you will be getting the above output.
Hope it helps!!
Thanks @supriya117 It works
1 Like
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.