Trim timestamp from datetime format

Hi, I am reading date from string variable the format is dd/MM/yyyy

like 15/06/2020

But when I convert into DateTime format I am getting 15/06/2020 00:00:00
How can we trim the timestamp?
@Palaniyappan @Lahiru.Fernando

1 Like


DateTime.ParseExact(FromDate,“dd/MM/yyyy”, CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)

1 Like

Hi @balkishan

If the timestamp is always like 00:00:00
Then you can simply replace the string by .replace(“00:00:00”,“”)

this is not the right way bro.
My variable is DateTime only
you can’t use .Replace behind the DateTime var

Not this way bro.

I have converted my var from string to DateTime again you want me to convert into string.

1 Like

Have you try this


No, same get the timestamp.

its working

There is no such thing, a DataTime type will always have a “time” part in it, you need to just ignore it…

Hey @balkishan

if you are using a dateTime variable, the time part will always be there bro… You cannot remove that from a datetime variable. if you want to remove that, then you have to convert it to a string and format the date.

You can just ignore the time part as it just have the default 00:00:00 value… If you really want to remove it, there is no other option other than converting it to a string and formatting it…


This can be obtained
With this expression
Dat_value = DateTime.Date
Where Dat_value is a variable of type System.DateTime

Which would give us only the date value without timestamp

Cheers @balkishan

1 Like

no, this will be the same, time will be 00:00 anyway…

see I don’t want again convert DateTime into String…

1 Like

There is not Date function after DateTime bro

1 Like

It will come in Now


yeah, I got the solution. Thanks, @sandeep13.

1 Like