Date format Change1

Hi I want to change date format
11/04/2023 12:47PM to 20230411
Please provide solution

Hi @Kuldeep_Pandey
give a try with

DateTime.ParseExact(strInput, "dd/MM/yyyy hh:mmtt", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyyMMdd")

Regards

Hi @Kuldeep_Pandey

Try this
image

Hope this might help you :slightly_smiling_face:

1 Like

Thankyou Team


Its giving me error

Hey @Kuldeep_Pandey

got your error, give a try with this new

DateTime.ParseExact(strInput, {"dd/MM/yyyy hh:mmtt", "dd/MM/yyyy h:mmtt", "d/MM/yyyy hh:mmtt", "d/M/yyyy hh:mmtt", "d/MM/yyyy h:mmtt"}, System.Globalization.CultureInfo.InvariantCulture).ToString("yyyyMMdd")

if any format is missing please add within the {} in the above code,

Regards

I am getting Output is diff Like 20231104
But in the middle i want month

Try this

image

Cheers,

1 Like


Again Error

What Will be the variable type in this?

string type

Its not working but

did you use my code? can i see your error?


Pls See error message

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