var date = new Date(); var d = date; d = [ '0' + d.getDate(), '0' + (d.getMonth() + 1), '' + d.getFullYear(), '0' + d.getHours(), '0' + d.getMinutes() ]; alert(); alert(date); |
1 answer
The assignment operator in javascript is right associative - this means that the value of the right side is calculated first and only then the result is assigned to the left.
In this case, the values of the array are calculated first, and only then the new value is assigned to the variable d .
|
Dateobject is placed with the current date and time. Details you can look in the textbook - learn.javascript.ru/datetime - mihdan