<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <form name="frmMain" action="" method="post"> <script language="JavaScript"> function jsTimeDiff(strDateTime1,strDateTime2){ datetime1 = new Date(strDateTime1); datetime2 = new Date(strDateTime2); var one_day = 1000*60; var defDate = (datetime2.getTime() - datetime1.getTime()) / one_day return defDate; } document.write("Time Diff 1 = " + jsTimeDiff("12 Jan 2012 09:30:20","12 Jan 2012 10:30:20")+" Minutes<br>"); // DD MM YYYY document.write("Time Diff 2 = " + jsTimeDiff("12 Jan 2012 09:30:00","12 Jan 2012 12:00:00")+" Minutes<br>"); // MM/DD/YYYY document.write("<hr>") </script> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท