Date with AM PM

Hi ,

I want to remove the date format which consist of time and AM PM . I want to remove the

time and get only date. I just want 1/19/2023 removing time
Assign: String ‘1/19/2023 2:14 pm’ was not recognized as a valid DateTime.

image

Hi @marina.dutta

Try the below syntax:

dateTimeValue = DateTime.ParseExact(str_attached_files_date, "M/d/yyyy h:mm tt", System.Globalization.CultureInfo.InvariantCulture).ToString("M/d/yyyy")

Regards

1 Like

@marina.dutta,

Use this in Assign activity

str_attached_files_date = DateTime.ParseExact(str_attached_files_date, {"MM/dd/yyyy hh:mm tt"}, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None).ToString("MM/dd/yyyy")

Thanks,
Ashok :slight_smile:

1 Like

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