Convert Date to Timestamp
function Get_unix_time (time1) {
var newstr = time1.replace (/-/g, '/');
var date = new Date (NEWSTR);
var time_str = Date.gettime (). toString ();
Return time_str.substr (0, 10);
}
I. Time-conversion timestamp
function TransDate (endTime) {
var date=new date ();
Date.setfullyear (endtime.substring (0,4));
Date.setmonth (endtime.substring (5,7)-1);
Date.setdate (endtime.substring (8,10));
Date.sethours (endtime.substring (11,13));
Date.setminutes (endtime.substring (14,16));
Date.setseconds (endtime.substring (17,19));
Return Date.parse (Date)/1000;
}
Two. Timestamp conversion time
(1): Convert to 2011-3-16 16:50:43 format:
Function GetDate (tm) {
var tt=new Date (parseint (tm) *). toLocaleString (). Replace (/year | month/g, "-"). Replace (/day/g, "")
return TT;
}
(2): converted to March 16, 2011 16:50:43:
Function GetDate (tm) {
var tt=new Date (parseint (tm) *). toLocaleString ()
return TT;
}
(3): Convert to March 16, 2011 16:50
Function GetDate (tm) {
var tt=new Date (parseint (tm) *). toLocaleString (). substr (0,16);
return TT;
}
Calculate the date after a few days, JS days calculation, TIME calculation
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title> Calculate the date after a few days, JS days calculation, TIME calculation-www.jbxue.com</title>
<style type= "Text/css" >
<!--
Body {font-family: "Song body"; font-size:9pt; margin-top:0px; margin-left:0px; margin-right:0px}
A {color:black; font-size:9pt; font-weight:400; Text-decoration:none}
a:hover {color:red; font-size:9pt; font-weight:400; Text-decoration:underline}
a:active {font:9pt "song body"; cursor:hand; color: #FF0033}
-
</style>
<body>
<center><font color=red face= "Official script" size=6> record a few days after the date </font></center>
<center>
<table border=0 bordercolor=blue borderlight=green style= "border-collapse:collapse" cellpadding= "0" cellspacing= " 0 ">
<TR><TD align=center><font size=5 color=red face= "Arial, Helvetica, Sans-serif" ><strong> Below is the effect display area!</STRONG></FONT></TD></TR><TR><TD align=center> <script language= "JavaScript" >
<!--Begin
function AddDays (form) {
Daystoadd=document.form.daystoadd.value;
var now=new Date ();
var newdate=new Date ();
var newtimems=newdate.gettime () + (daystoadd*24*60*60*1000);
Newdate.settime (Newtimems);
Document.form.display.value=newdate.tolocalestring ();
}
End-To
</script>
<form name=form>
<input type=text name=daystoadd size=4 value=10 onfocus= "This.select ()" onmouseover= "This.focus ()" >
<input Type=button value= "The date will be:" onclick= "AddDays (this.form)" name= "button" >
<input type=text name= "display" size=20 value= "" >
</form>
</td></tr>
</table></center>
<center>
<script language= "JavaScript" >
<!--Hide
function Gohist (a)
{//www.jbxue.com
History.go (a);
}
-
</script></center>
</body>
Conversion and calculation of JS time format and timestamp what day is the date after a few days