ASP.Net MVC - how to convert datetime in format (yyyy-MM-dd HH:mm:ss.fff) -


i have error when try update table have field datetime, error :

system.formatexception: string not recognized valid datetime. 

in database format datetime :

"yyyy-mm-dd hh:mm:ss.fff"     ex : 2017-08-18 00:00:00.000 

but view result format datetime :

"mm/dd/yyyy hh:mm:ss"    ex:  8/18/2017 00:00:00 

so error , can not update, please me problem. thank you

convert.todatetime(your date variable, cultureinfo.currentculture).tostring("yyyy-mm-dd hh:mm:ss.fff");

you can convert date using above code


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -