The example of this paper is analyzed. NET and JS time date format conversion problem. Share to everyone for your reference, specific as follows:
The 1415349957524 integers in JS actually represent the number of milliseconds between 1970.1.1 00:00:00 to today's point in time. And in. NET, we can use the Ticks property to get the number of milliseconds between 0001.1.1 00:00:00 to today's point in time.
The specific code implementation looks like this:
Js:
Get the number of milliseconds from 1970.1.1 00:00:00 to today
var mildate = + (new Date);
. Net:
Get the number of milliseconds from 1970.1.1 00:00:00 to today
var datestage = new DateTime (1970, 1, 1);
var datenow = DateTime.Now.ToUniversalTime ();
var datenowts = new TimeSpan (datenow.ticks-datestage.ticks);
var datemil = (long) datenowts.totalmilliseconds;
PS: For time and date show interested friends can also refer to the site online tools:
Unix timestamp (timestamp) conversion tool:
Http://tools.jb51.net/code/unixtime
Online Worldwide Time query:
Http://tools.jb51.net/zhuanhuanqi/worldtime
Online Perpetual calendar:
Http://tools.jb51.net/bianmin/wannianli
Web calendar:
Http://tools.jb51.net/bianmin/webwannianli
More interested readers of asp.net related content can view the site topics: "asp.net operation JSON tips summary", "asp.net string operation tips Summary", "ASP.net Operation XML Skills summary", "asp.net file Operation skills Summary", " asp.net Ajax Skills Summary topic and the "ASP.net cache operation skills Summary."
I hope this article will help you to ASP.net program design.