Get specific DateTime variable format

Hi! I want to get a DateTime variable in format yyyy/MM/dd, is this possible? I need the variable to be DateTime format, not a String. Thanks!!

Hi @FlorSiri

Use this syntax

DateTime.ParseExact(your_String_variable, “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy/MM/dd")

Datetime variables don’t have formats. They store values. To see the date in a human readable format you have to cast it .ToString

1 Like

Hi! Thanks for your reply :slight_smile: but I actually need the variable to be in DateTime type, I think it is not possible though

Hi! I understand, thanks for the info! :slight_smile: I will try to find another way

Find another way for what? What are you trying to accomplish?

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