c# - String not getting converted to datetime -


i have have excel file getting date in string format "30-12-1899 07:50:00:am"

when trying convert datetime giving error as

string not recognized valid datetime 

i trying convert this

convert.todatetime(hometoschool[7],new datetimeformatinfo { shortdatepattern = "dd-mm-yyyy", dateseparator = "-" }) 

use datetime.parseexact

string mydate = "30-12-1899 07:50:00:am"; datetime dt1 = datetime.parseexact(mydate, "dd-mm-yyyy hh:mm:ss:tt",                                             cultureinfo.invariantculture) 

for more information date , time format strings,


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -