mercredi 8 mars 2017

Date Time null in database

As my title above I got a table in my database that is DateTime datatype and it is null value. And I got this line of code that I am using but I don't know why that it is returning 12:00

string FitaCorIn1 = Convert.ToDateTime(req.FACorrectionIn1).ToString("hh:mm") == null ? "00:00" : Convert.ToDateTime(req.FAIn1).ToString("hh:mm");
string FitaCorOut1 = Convert.ToDateTime(req.FACorrectionOut1).ToString("hh:mm") == null ? "00:00" : Convert.ToDateTime(req.FAIn1).ToString("hh:mm");

So as you can see in my code If the value of datetime is null I want to display 00:00 and if it is not null it will display the current value.

NOTE

12 Hours Format

Aucun commentaire:

Enregistrer un commentaire