Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
parameterlist4 is 2016-10-13T09:27:35.000Z

After parsing I am getting 2016-10-13T09:27:35 then adding 1 second

myDateTimetest = 2016-10-13T09:27:36 (Add Seconds)

Then I am converting it to "o" format it gives me "2016-10-13T09:27:36.0000000Z" string

which format do I have to use to get timestamp in this format "2016-10-13T09:27:36.000Z"?

Thank you.

What I have tried:

DateTime myDateTime = DateTime.Parse(parameterlist4);

var myDateTimetest = myDateTime.ToUniversalTime();


for (int i = 0; i < 90; i++)
{
//string timestampadd = Convert.ToString (myDateTime);

string timestampadd = myDateTimetest.ToString("0");

SnapshotDateTimenew[i] = timestampadd;

myDateTimetest = myDateTimetest.AddSeconds(1);

}
Posted
Updated 7-Dec-16 6:00am

1 solution

Try this:
C#
string myFormat = myDateTime.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900