REGISTER











Date calendaristice
#1
Un obiect Data stochează numărul de milisecunde începând cu data de 1970-01-01 00:00:00 UT.
Code:
new Date () // creează o nouă instanță reprezentând Data curentă data / ora.
new Date ( 2010 , 2 , 1 ) // creează o nouă instanță, reprezentând data de 2010-Mar-01 00:00:00
new Date ( 2010 , 2 , 1 , 14 , 25 , 30 ) // creează o nouă instanță, reprezentând data de 2010-Mar-01 14:25:30
new Date ( "2010-3-1 14:25:30" ) // creează o nouă instanță Data dintr-un șir.
Metode de a extrage câmpurile sunt furnizate, precum și ca un instrument util toString :
Code:
var d = new Date ( 2010 , 2 , 1 , 14 , 25 , 30 ) ; // 2010-Mar-01 14:25:30

// Afișează '2010-3-1 14:25:30 ":
alert ( d. getFullYear () + '-' + ( d. getMonth () + 1 ) + '-' + d. getDate () + ' '       + d. getHours () + ':' + d. getMinutes () + ':' + d. getSeconds () ) ;

// Built-in întoarce toString ceva
de genul "Luni o mar 2010 14:25:30 GMT-0500 (EST)":
alert ( d ) ;
Reply



Powered by MyBB All rights reserved
Developed with for FASTCS 2011 - 2024 FASTCS