How to pass date as a string

Hello All,

I want to pass Date as string from “expression editor” but getting below error. kindly check screen shot for your reference.

DateTime.Parse(“01/01/2019”).ToString(“MMMM-yyyy”)
Store the output in string variable…Hope this helps

5 Likes

@priyankamalusare It seems to be accepting only DateTime type. If you want to change the format as mentioned in expression editor, use below expression.

DateTime.ParseExact(“01/01/2019”,“MMMMM-yyyy”, System.Globalization.CultureInfo.InvariantCulture)

Syntax: DateTime.ParseExact(input_date, “Format” , System.Globalization.CultureInfo.InvariantCulture)

5 Likes

@priyankamalusare I would prefer you use the DateTime.ParseExact function in this way if the Date you are providing as String , will always be in that Same format :

DateTime.ParseExact(“01/01/2019”,“dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“MMMM-yyyy”)

This needs to be Saved in a String Variable

2 Likes

Thanks all . DateTime.ParseExact(“01/01/2019”,“MMMMM-yyyy”, System.Globalization.CultureInfo.InvariantCulture) solution worked for me. thank you so much again.

Cheers,
Priyanka

2 Likes

@priyankamalusare Please mark the relevant reply as solution so that this thread gets closed.

1 Like

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