I am aware of the standard procedure for displaying a DateTime
in a custom format, like so:
MessageBox.Show(dateSent.ToString(\"dd/MM/yyyy hh:mm:s
DateTime?
is syntactic sugar for NullableToString(format)
overload.
However, you can access underlying DateTime
struct using Value
property. But before that use HasValue
to check, if the value exists.
MessageBox.Show(dateSent.HasValue ? dateSent.Value.ToString("dd/MM/yyyy hh:mm:ss") : string.Empty)