#date, #javascript date #date in javascript, #javascript date object, #date methods,
Date time Method in JavaScript
JavaScript provides Date Method to work with date & time, including days, months, years, hours, minutes, seconds, and milliseconds:
getDate( ) Returns day of the month.
getDay( ) Returns day of the week from 0 to 6.
getFullYear( ) Returns year with 4 digits.
getMonth( ) Returns month from 0 to 11.
getHours( ) Returns the hour (0 to 23).
getMinutes( ) Returns the minute component.
getSeconds( ) Returns the seconds component.
toString( ) Returns the string representation of Date object
var d=new Date();
var str=d.toString();
The result of str will be:
Mon Feb 04 2013 12:30:59 GMT+0530 (India Standard Time)
toDateString( ) Returns the string representation of date portion of Date object.
var d=new Date();
var str=d.toDateString();
The result of str will be:
Mon Feb 04 2013
toTimeString( ) Returns the string representation of time portion of Date object
var d=new Date();
var str=d.toTimeString();
The result of str will be:
12:33:39 GMT+0530 (India Standard Time)