Change datetime variable format

Hi All,

I have a datetime variable now and the format is "MM/dd/yyyy HH:mm:ss”. How could I change the format to “MM/dd/yyyy” (essentially get rid of the hour, minute and seconds) and keep this variable as a datetime variable?

Thank you for your help.

1 Like

Hi Buddy @ianhyj

use like this if variable is in_datetime_var

str_format = in_datetime_var.ToString(“MM/dd/yyyy”)

out_datetime_var = Datetime.Parseexact(str_format,“MM/dd/yyyy”,system.globalization.cultureinfo.invariantculture)

Cheers

1 Like

is that working buddy… @ianhyj

Cheers

Thanks!

1 Like

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