Converting String To Date In Desired Format

I have a string “05/18/2021” and on converting it to DateTime it becomes
[05/18/2021 00:00:00] which is in MM/dd/yyyy hh:mm:ss format.

I wish to get a DateTime results in dd/MM/yyyy format WITHOUT converting it to string.

The output has to be DateTime itself → [18/05/2021]

Also, there are times when the string is of the format “05-APR-2021”, which also has to be converted to [05/04/2021]

Help would be most appreciated, thanks in advance!

Kind Regards,
Ashwin A.K

DateFormat.xaml (5.1 KB)
@ashwin.ashok try this…!


Hi @kadiravan_kalidoss ,

I’m sorry to say but it didn’t work.
The date format isn’t showing up as expected.

You can’t not convert it to string. Seeing it as output like “18/05/2021” IS a string.

DateTime.Parse(“05/18/2021”).ToString(“dd/MM/yyyy”) → 18/05/2021

DateTime.Parse(“05-APR-2021”).ToString(“dd/MM/yyyy”) → 05/04/2021

Hi @postwick ,

Thank you for your response, but I wish to convert the string into DateTime format.

DateTime.Parse(“05/18/2021”) → [05/18/2021 hh:mm:ss]

But the output I wish to achieve is:

DateTime.?(“05/18/2021”) → [18/05/2021]

I’m not sure if this is even possible.

The output of 18/05/2021 or 05/18/2021 IS A STRING. These are not “DateTime format” - there is no such thing. These are strings.

It can’t not be a string. In order to display, or type etc, the value that’s in a DateTime variable, you MUST output it as a string.

DateTimes aren’t in a format. They’re a datatype of DateTime.

DateTime.Parse(“05/18/2021”).ToString(“dd/MM/yyyy hh:mm:ss”)

But that will always give 00:00:00 as hh:mm:ss so why would you want that? There’s no time indicated in 05/18/2021.

Hi @postwick ,

Once again, thank you for your response.

Regarding the input data type, I am aware that its a string that goes in.


In India, we use dd/MM/yyyy, and I know we can convert it by appending a .ToString(dd/MM/yyyy") to get the desired response, but the reason I wish to make this conversion is because after refining the data, it is pooled into an Oracle DB where the Data Column is of Type DateTime.

I wanted to know if it was possible to get the result in DateTime Format(As you can see above in the screenshot, there is a System.DateTime format), which is in [dd/MM/yyyy].

I wish to know whether its feasible or not.

No, it’s a string that comes OUT. It can’t be anything else. In order to display the value that’s inside a DateTime you MUST output it as a string. You aren’t converting what’s inside the DateTime variable. You can’t, anyway. It’s a DateTime.

It’s just like if you have a variable myInt (Int32) with a value of 3, if you want to display that 3, type it into a web page, etc you MUST output it as a string with myInt.ToString. You aren’t changing what’s in the myInt variable, you’re just outputting it as a string.

“get the result in DateTime Format”

There is no such thing. This is a nonsensical statement.

" it is pooled into an Oracle DB"


Hi @postwick ,

Alright, I get your point.
Calm down.

I’m not un-calm. I’m just trying to explain.

I believe that a DateTime actually stores values as milliseconds since 1970. What’s inside the DateTime is not 05/08/2021 nor anything like that.

How are you getting the data into your Oracle DB?

hi @postwick ,

There is a DataBase Activity Package that helps us with that.

We first establish a connection and then insert records using the Activity shown in the screenshot below before disconnecting from the DB.

Then as long as the column with the date in it is a DateTime column, that should work. You don’t need to do any sort of conversion of the DateTime value, no formatting, nothing - there is no format inside a DateTime. Oracle will understand the value. It would probably understand it properly even if it’s a string column in the DT.

1 Like

Hi @postwick ,

Its actually the End User who wanted this conversion to happen, and we weren’t sure if it was feasible or not.
Thank you for taking the time to look into this, I appreciate it.

Kind Regards,
Ashwin A.K

The end user is asking for something that doesn’t exist. There’s no such thing as formatting what’s inside a DateTime. You choose a format when displaying the value.

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