Comments on: นำเวลาที่ Server มาแสดงที่ Browser ง่ายๆ โดย php และ JavaScript https://www.unzeen.com/article/92/ :// Fri, 26 Jul 2019 08:00:09 +0000 hourly 1 By: danya https://www.unzeen.com/article/92/comment-page-1/#comment-1084 Thu, 12 Sep 2013 06:51:03 +0000 /?p=92#comment-1084 ตอนผมกำลังคิดเรื่องนี้ ผมดันกำหนดตัวแปร global timespend ไว้ โดยจะบวก +1 ทุกๆ 1000 sec

แล้วเอาเวลาของ Server มาบวกกับ timesepnd ก็จะได้เวลาปัจจุบัน ณ ตอนนั้น

เช่น ผมเปิดเว็บมา ได้เวลา 10:00:00 Javascript เริ่มบวกตัวเลข timespend ทุกๆ 1000sec เมื่อเรามาแสดงแล้ว ก็เอาเวลา Server มาบวกกับ timespend ก็จะได้เวลา Server ที่อับเดตนั้นเอง

แต่ เว็บนี้ ทำอีกแบบหนึ่ง ถือว่าดี ไม่ต้องใช้ตัวแปร global ฮาๆๆ

]]>
By: neppyweb https://www.unzeen.com/article/92/comment-page-1/#comment-527 Wed, 23 Feb 2011 22:37:20 +0000 /?p=92#comment-527 ทำไมผมลองแล้ว มันขึ้นว่า NaN/NaN/NaN NaN:NaN:NaN อ่ะครับ

]]>
By: LookHin https://www.unzeen.com/article/92/comment-page-1/#comment-412 Mon, 05 Oct 2009 08:22:04 +0000 /?p=92#comment-412 ขอบคุณที่แบ่งปัน code กันนะครับ

]]>
By: JobPattaya.NeT https://www.unzeen.com/article/92/comment-page-1/#comment-411 Mon, 05 Oct 2009 08:14:13 +0000 /?p=92#comment-411 อันบนใช้ Firfox อันนี้ใช้ IE คะ

now = new Date();
var thday = new Array (“”,””,
“”,””,””,””,””);
var thmonth = new Array (“มกราคม”,”กุมภาพันธ์”,”มีนาคม”,
“เมษายน”,”พฤษภาคม”,”มิถุนายน”, “กรกฎาคม”,”สิงหาคม”,”กันยายน”,
“ตุลาคม”,”พฤศจิกายน”,”ธันวาคม”);

document.write(” ” + thday[now.getDay()]+ ” “+ now.getDate()+ ” ” +
thmonth[now.getMonth()]+ ” ” + (0+now.getYear()+543));

]]>
By: JobPattaya.NeT https://www.unzeen.com/article/92/comment-page-1/#comment-410 Mon, 05 Oct 2009 08:09:32 +0000 /?p=92#comment-410 <!–
// Array of day names
var dayNames = new Array("","","","","","","");
var monthNames = new Array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม", "สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
var dt = new Date();
var y = dt.getYear() – 109;
// Y2K compliant
if (y

]]>
By: LookHin https://www.unzeen.com/article/92/comment-page-1/#comment-377 Tue, 04 Aug 2009 17:31:52 +0000 /?p=92#comment-377 ก็ตรง current_time.getMonth()+1 ก็เปลียนเป็น

arrMonthName[current_time.getMonth()+1]

เท่านี้นะครับ ต่อเองนะ นี้ก็สุดๆๆแล้ว ^_^

]]>
By: Jaideejung007 https://www.unzeen.com/article/92/comment-page-1/#comment-376 Tue, 04 Aug 2009 17:24:12 +0000 /?p=92#comment-376 แล้วจะให้กระผมต่อยังไงล่ะนั้น

ยิ่ง โง่ๆๆ จาวาสคริปต์อยู่

ยังไงก็วาน ช่วยทำให้หน่อยนะครับ

ว่างๆ ค่อยทำก็ได้ครับ ไม่ต้องซีเรียส

ขอบคุณครับท่าน

]]>
By: LookHin https://www.unzeen.com/article/92/comment-page-1/#comment-375 Tue, 04 Aug 2009 17:12:44 +0000 /?p=92#comment-375 น่าจะทำ array เก็บรายชือของเดือนเอาไว้นะครับ


ลองต่อดูนะ ยังไมได้ลองเหมือนกันใช้ได้หรือเปล่าไม่รู้ ^_^

]]>
By: Jaideejung007 https://www.unzeen.com/article/92/comment-page-1/#comment-374 Tue, 04 Aug 2009 17:05:50 +0000 /?p=92#comment-374 อ่า ไม่ช่วยหน่อยหลอครับท่าน แง่มๆๆๆ

อยากได้จริงๆ นะนั้น

]]>
By: LookHin https://www.unzeen.com/article/92/comment-page-1/#comment-372 Tue, 04 Aug 2009 16:35:24 +0000 /?p=92#comment-372 กาก เรืองเปลียนเดือนเป็นชือนั้น ต้องทำโปรแกรมเองแล้วหละครับ สู้ๆๆๆๆๆๆๆๆๆๆๆๆๆ

]]>