This article describes the method of converting date types in C#. Share it for your reference. The specific analysis is as follows:
For example: convert the date 1999-5-31 11:20 to /Date(928120800000+0800)/
Among them, 928120800000 is actually a millisecond interval between January 1, 1970 and this DateTime.
0800 represents the time zone, (0800 represents the Chinese region)
The specific code is as follows:
Copy the codeThe code is as follows:
public long MilliTimeStamp(DateTime TheDate)
{
DateTime d1 = new DateTime(1970, 1, 1);
DateTime d2 = ();
TimeSpan ts = new TimeSpan( - );
return (long);
}
{
DateTime d1 = new DateTime(1970, 1, 1);
DateTime d2 = ();
TimeSpan ts = new TimeSpan( - );
return (long);
}
I hope this article will be helpful to everyone's C# programming.