How to convert date time


how to convert “08/21/2018 08:06:55 PM” from excel row to “2018-08-21T20:06:55.0” format to other excel.


Assign to a date variable: Convert.ToDateTime(dt.Rows(0)(“YourDate”).ToString).Date

Then while feeding it in your website convert your date as below

DateTime.ParseExact(convertedDate.ToString(“MM/dd/yyyy”), “MM/dd/yyyy”, Nothing).ToString(“yyyy-MM-dd”)


You can directly use this : DateAndTime.Now.ToString(“yyyy-MM-dd hh:mm:ss”)


Use This

Convert.ToDateTime(Your String Variable Of Date).ToString(“yyyy-MM-dd ‘T’ HH:mm:ss”)




@ Himanshu.joshi Worked for me. Thanks for your solution.


@ Rashmi
Thanks for your support Reshmi.