User-1330468790 posted
Hi venkatzeus,
Actually, what you have got in debugger is a string in format "dd/MM/yyyy hh:mm:ss" which is from an implicit transform with the ToString()
method of the DateTime .
The DateTime instance does not have a format. It just a data structure which we used to store the value representing date and time.
The DateTime instance "dtVal" can be transformed to any format of string as long as you
provide a format.
You already got the correct value of the date and time so that you
don't need to do anything but store it directly to wherever you want.
Only if you want to display the value of the
DateTime instance, you have to consider the format stuff.
Solution:
In your case, if you want to display the DateTime value, you could refer to Custom date and time format strings
For example:
string dateTime = dtVal.ToString("MM/dd/yyyy hh:mm:ss"); // This will give you a string like "11/22/2019 00:00:00"
Otherwise, there is nothing to do with the
DateTime instance "dtVal".
Hope this can help you.
Best regards,
Sean