c# - Datetime to string: differents behavior depending on the converted datetime -


i use c# code convert datetime string:

mydatetime.tostring("dd/mm/yyyy hh:mm") 

it works, not every time. mean?

if input datetime is, example, 2016-10-19 17:27:41.727, string expected, 19/10/2016 17:27. if day in datetime (and/or month) has 1 digit, weird.

if input 2016-01-07 14:58:13.560, 1/7/2016 , if 2016-10-26 17:14:16.000 10/6/2016.

do know why? how can set leading 0 days , months 1 digit? and, further, why don't see time part in date wrote examples?

update

this input.

some datetime fields sql server database (this sql server management studio).

most datetime has invalid value (day , month mixed)

new datetime(2016, 01,  07,14,58,13,56).tostring("dd/mm/yyyy hh:mm") 

returns 07-01-2016 14:58.

take how read datetime value database. believe problem there. (for example sqldatareader.getdatetime)


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -