Convert string date to another string format date

date_str_1 = 1/19/2023
date_str_2 = Jan 19, 2023

I want to convert date_str_1 (m/d/yyyy format) to date_str_2 (MMM d, yyyy) format.

Please advise. Thanks

@shrishti.diggikar

You can use this

DateTime.ParseExact(Date1,"M/d/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("MMMd, yyyy")

Cheers

1 Like

Hi @shrishti.diggikar ,

Could also check with the below Expression :

CDate("1/19/2023").ToString("MMM dd, yyyy")

image

Hi @shrishti.diggikar

- Assign -> date_str_2 = DateTime.ParseExact(date_str_1,"M/dd/yyyy", System.globalization.CultureInfo.InvariantCulture).toString("MMM d, yyyy")

Check the below workflow for better understanding,
2024.xaml (18.1 KB)

Hope it helps!!

Hi @shrishti.diggikar

Use below expression in Assign Activity

date_str_1 = 1/19/2023

DateTime.ParseExact(date_str_1,“M/d/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMd, yyyy”)

Output =Jan 19, 2023

Hope it will helps you :slight_smile:
Cheers!!

@shrishti.diggikar

Assign date_str_1 = "1/19/2023"
Assign date_obj = DateTime.ParseExact(date_str_1, "M/d/yyyy", CultureInfo.InvariantCulture).ToString("MMM d, yyyy")

DateTime.ParseExact(datevariable,“M/d/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MMM d, yyyy”)

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