how to convert datetime in C#, please Convert this format 27/01/2016 08:00:17 to T,270116,040017 -


how convert datetime in c#? please convert format 27/01/2016 08:00:17 t,270116,040017, expected output - t,270116,040017 , datetime - 27/01/2016 08:00:17

use datetime.parseexact addhours, create custom formatting:

string dtstr = "27/01/2016 08:00:17"; datetime dt = datetime.parseexact(dtstr, "d/m/yyyy hh:mm:ss", cultureinfo.invariantculture); dt = dt.addhours(-4); string dtresult = dt.tostring("t,ddmmyy,hhmmss"); 

result:

t,270116,040017 

note: datetime string format looks rather unusual. check this more info.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -