How do you format the date time to just date?
For example, this is what I retrieved from the database: 12/31/2008 12:00:00 AM, but I just want to show the date and no time.
Either use one of the standard date and time format strings which only specifies the date (e.g. "D" or "d"), or a custom date and time format string which only uses the date parts (e.g. "yyyy/MM/dd"). This works if you want a string result. If you want a date result, see madcolor's response below.
Just format the output ToString("mm/dd/yyyy"); to be able to see exactly what you want.
To access the current system date as a String , use the DateString property. To get or set the current system time, use the TimeOfDay property.
You must enclose a Date literal within number signs ( # # ). You must specify the date value in the format M/d/yyyy, for example #5/31/1993# , or yyyy-MM-dd, for example #1993-5-31# . You can use slashes when specifying the year first.
Either use one of the standard date and time format strings which only specifies the date (e.g. "D" or "d"), or a custom date and time format string which only uses the date parts (e.g. "yyyy/MM/dd").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With