Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convert DateTime to yyyy-mm-ddT00:00:00.000Z format in C#?

Tags:

c#

datetime

I want to convert dateTime to the above given format. I tried to look the docs but didnt find much information.

like image 986
wayfare Avatar asked Oct 28 '13 19:10

wayfare


People also ask

How do I change date format in DateTime?

It should be formatted like this: myDateTime. ToString("yyyy/MM/dd hh:mm:ss"); or myDateTime. ToString("yyyy/MM/dd); Because mm is for minute and for month MM should be used.

How do you convert DateTime to mm dd yyyy?

string date = DateTime. ParseExact(SourceDate, "dd/MM/yyyy", CultureInfo. InvariantCulture). ToString("yyyy-MM-dd");

What is DateTime format TZ?

The DATETIME-TZ data type consists of three parts: · An ABL date and time (as for DATETIME) and. · An integer representing the time zone offset from Coordinated Universal Time (UTC) in minutes. ABL stores DATETIME-TZ data in UTC, along with the time zone offset of the DATETIME-TZ.


1 Answers

Just pass the format "yyyy-MM-dd'T'HH:mm:ss.fffffff'Z'" to ToString

string str = DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss.fffffff'Z'");
like image 124
Habib Avatar answered Oct 02 '22 13:10

Habib