How to remove time stamp from date

Input = str_ETADate=05/21/2023 00:00:00 string format

want output date_ETADate = 05/21/2023 datetime format

I have tried

but time stamp remains same.

Please suggest solution how to remove time stame in date time format

variable.toSting.Trim.Replace(" 00:00:00",“”)

Try this


If you need as string then you can get in whatever format you want…when stored as datetime or date it would have all of it

Any variable in datetime format will have date and time also…only while converting back to string you can give whatever format you need



already tried but this is in string, need in date time

Hi @satish.rathi59


Can you try this
Hope this helps you

1 Like

That format is for the ParseExact to know how the input string is formatted. So change it to include the time:

DateTime.ParseExact(str_ETADate,“dd/MM/yyyy HH:mm:ss”,System.Globalization.CultureInfo.InstalledUICulture)

Now this gives you a datetime, but you’re not formatting it on the output side, so add .ToString to it:


Note that this is not possible. A datetime doesn’t have a format, it’s an internal value type. It always internally includes the date and time. You only format it when you’re outputting it with .ToString

1 Like

Hello @satish.rathi59

please Try with this Expression:
DateTime.ParseExact(“05/21/2023 00:00:00”,“MM/dd/yyyy HH:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)

1 Like


Str_Date=Str_ETADate.Split(" "c)(0)

1 Like

H! @satish.rathi59

instead of doing all ,simply use this expression

Convert.ToDateTime(“05/21/2023 00:00:00”).ToString(“MM/dd/yyyy”)

for the reference check below screenshot!


Please try this,
str_ETADate=05/21/2023 00:00:00
DateTime.ParseExact(str_ETADate,“MM/dd/yyyy HH:mm:ss”,Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)

1 Like

Hi @satish.rathi59

If you want the output in datetime format you will get the Time Stamp value for that. If you don’t want the time stamp value try the below syntax:


The above syntax will return the output in the format MM/dd/yyyy and date_ETAdate is of datatype String.

Hope you understand!!

1 Like

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