var myDate = new Date(); myDate .getYear(); //Get the current year (2 digits) myDate.getFullYear(); //Get the complete year (4 digits, 1970-????) myDate.getMonth(); / / Get the current month (0-11, 0 represents January) myDate.getDate(); // Get the current day (1-31) myDate.getDay(); // Get the current week X (0 -6,0 represents Sunday) myDate.getTime(); // Get the current time (the number of milliseconds since 1970.1.1) myDate.getHours(); // Get the current hours (0-23 ) myDate.getMinutes(); //Get the current minutes (0-59) myDate.getSeconds(); //Get the current seconds (0-59) myDate.getMilliseconds(); //Get the current milliseconds (0-999) myDate.toLocaleDateString(); //Get the current date var mytime=myDate.toLocaleTimeString(); //Get the current time myDate.toLocaleString() ; //Get date and time
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn