How to convert date time


#1

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


#2

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”)


#3

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


#4

Use This

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

Regards

Update


#5

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


#6

@ Rashmi
Thanks for your support Reshmi.


#7