Change Timezone from UTC to EST

Hi ,
I need help in converting a string value in yyyy-MM-dd HH:mm:ss format to EST time zone by retaining the same format.

Thanks in advance

Hey @besakkiappan46

1st Assign:

Input_DateTime = DateTime.ParseExact(str_InputDate,"yyyy-MM-dd HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture)

2nd Assign:

Output_DateTime = TimeZoneInfo.ConvertTimeFromUtc(Input_DateTime,TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"))

Screenshot for your reference:

Variable Panel:

Output Panel:
image

Regards,
Ajay Mishra

@Ajay_Mishra Everything is fine. But Just one question. I have AM/PM at the end of the Str_InputDate after the seconds. It throws error. is there a way to convert the string ( yyyy-MM-dd HH:mm:ss am) to Datetime? or should I go for substring and ignore AM/PM at the end?

@besakkiappan46 Add tt
If AM/PM is in capital letters then:
yyyy-MM-dd HH:mm:ss tt

That’s it!

Regards,
Ajay Mishra

Thank you so much @Ajay_Mishra

@besakkiappan46 Your Welcome :innocent:

Happy Automation!

Best Regards,
Ajay Mishra

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.