Article From:

Original website:

var myDate = new Date();
myDate.getYear(); //Get the current year (2 bits)
myDate.getFullYear(); //Get a complete year (4, 1970-???)
myDate.getMonth(); //Gets the current month (0-11,0 for January) / / so the current month is myDate.getMonth () +1;
myDate.getDate(); //Get the current day (1-31)
myDate.getDay(); //Get the current week X (0-6,0 on behalf of Sunday)
myDate.getTime(); //Get the current time (the number of milliseconds starting from 1970.1.1)
myDate.getHours(); //Get the current number of hours (0-23)
myDate.getMinutes(); //Get the current number of minutes (0-59)
myDate.getSeconds(); //Get the current number of seconds (0-59)
myDate.getMilliseconds(); //Get the current millisecond (0-999)
myDate.toLocaleDateString(); //Get the current date
var mytime=myDate.toLocaleTimeString(); //Get the current time
myDate.toLocaleString( ); //Obtain date and time



About JS getting the last day of the month

new Date(2013,4).toJSON().substring(0,10)


Link of this Article: On the usage of time

Leave a Reply

Your email address will not be published. Required fields are marked *