JavaScript 타임 스탬프 및 날짜 문자열은 코드를 서로 변환합니다 (매우 간단함)
<html xmlns = "http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type"content = "text/html; charset = utf-8"/> <script type = "text/javascript"timestamp get the timestamp = 날짜 ()); timeStamp = timestamp/ 1000; // 현재 타임 스탬프는 : 1403149534Console.log ( "현재 타임 스탬프는" + timestamp); // 특정 시간 형식에서 타임 스탬프를 가져옵니다 var stringtime = "2014-07-10 10:21:12"; var timestamp 2 = timestporse (stringstamps); /1000; // 2014-07-10 10:21:12의 타임 스탬프는 다음과 같습니다. console.log (newDate.todatestring ()); // Wed, 2014 년 6 월 18 일 02:33:24 GMT Console.Log (newDate.TogMtString ()); // 2014-06-18T02 : 33 : 24.000zconsole.log (newDate.toistring (); Console.log (NewDate.tojson ()); // 2014 년 6 월 18 일 Console.log (NewDate.TolocalEdatestring ()); // 2014 년 6 월 18 일 오전 10:33:24 Console.log (NewDate.Tolocalestring ()); // 10:33:24 AM wember (NewDate.Tolocalestring); 18 2014 10:33:24 GMT+0800 (China Standard Time) Console.log (NewDate.ToString ()); // 10:33:24 GMT+0800 (China Standard Time) Console.log (NewDate.totimestring ()); // Wed, 18 Jun 2014 02:33:24 gmtconsole.log (newdate.toutcstring ()); date.prototype.format = function (format) { "m+": var date = { "m+": this.getmonth ()+1, "d+": this.getDate (), "h+": this.gethours (), "m+": this. this. ","s.getseconds () "Q+": math.floor ((this.getMonth ()+3) / 3), "s+": this.getMilliseconds ()}; if (/( y+)/i.test(format)) {format = format.replace (regexp. $ 1, (this.getsyear () + '') .substr (4 -regexp. $ 1.length)); } for (var k date) {if (new regexp ( "(" + k + ")"). test (format)) {format = format.replace (regexp. $ 1, regexp. $ 1.length == 1? date [k] : ( "00" + date [k]). substr (( "" + date [k])); }} return format;} console.log (newDate.format ( 'yyyy-mm-dd h : m : s'); </script>위의 것은 편집자가 가져온 JavaScript 타임 스탬프 및 날짜 문자열 변환 코드 (Super Simple)의 전체 내용입니다. 모두가 wulin.com을 지원하기를 바랍니다