Translate

Monday, May 5, 2014

15.Date Object

Creating Date Object 
Date Object is used with days and hours. We create it by using the Date () constructor.
We have 4 ways to create a Date Object
១៥. Date Object
Note:
All parameters Optional so we can put the number of parameters that we want.
data String may include:

Thu Sep 11 2008
Thursday, September 11, 2008
Thursday, September 11, 2008 5:24:39 PM
5:24:39 PM

example
១៥. Date Object

Date Method

getDate (): Return day from(1 to 30)
getDay ():Return weeks from (0 to 6) 
getFullYear (): Return year with 4 digits 
getMonth (): Return month from (0 (January) to 11 (December)) 
getHours (): Return hour from  (0 to 11) 
getMinutes (): Return minutes from (from 0 to 59) 
getSecondes ():Return  seconds in 1 minutes  (0 to 59) 
getTime (): the number of seconds from 1 January 1970 0 our arrival Date Object 
example
១៥. Date Object
Thu Jan 05 2012 11:42:53 GMT+0700 (SE Asia Standard Time)
Date: 5
Day: 4
Year: 2012
Month: 0
Hour: 11
Minute: 42
Second: 53

0 comments:

Post a Comment