w3schools
  
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About

JavaScript Date Object

« Previous Next Chapter »

Date Object

The Date object is used to work with dates and times.

Syntax

var myDate=new Date()

Note: The Date object will automatically hold the current date and time as its initial value!

Date Object Properties

F: Firefox, IE: Internet Explorer

Property Description F IE 
constructor Returns a reference to the Date function that created the object 1 4
prototype Allows you to add properties and methods to the object 1 4

Date Object Methods

Method Description F IE
Date() Returns today's date and time 1 3
getDate() Returns the day of the month from a Date object (from 1-31) 1 3
getDay() Returns the day of the week from a Date object (from 0-6) 1 3
getFullYear() Returns the year, as a four-digit number, from a Date object 1 4
getHours() Returns the hour of a Date object (from 0-23) 1 3
getMilliseconds() Returns the milliseconds of a Date object (from 0-999) 1 4
getMinutes() Returns the minutes of a Date object (from 0-59) 1 3
getMonth() Returns the month from a Date object (from 0-11) 1 3
getSeconds() Returns the seconds of a Date object (from 0-59) 1 3
getTime() Returns the number of milliseconds since midnight Jan 1, 1970 1 3
getTimezoneOffset() Returns the difference in minutes between local time and Greenwich Mean Time (GMT) 1 3
getUTCDate() Returns the day of the month from a Date object according to universal time (from 1-31) 1 4
getUTCDay() Returns the day of the week from a Date object according to universal time (from 0-6) 1 4
getUTCMonth() Returns the month from a Date object according to universal time (from 0-11) 1 4
getUTCFullYear() Returns the four-digit year from a Date object according to universal time 1 4
getUTCHours() Returns the hour of a Date object according to universal time (from 0-23) 1 4
getUTCMinutes() Returns the minutes of a Date object according to universal time (from 0-59) 1 4
getUTCSeconds() Returns the seconds of a Date object according to universal time (from 0-59) 1 4
getUTCMilliseconds() Returns the milliseconds of a Date object according to universal time (from 0-999) 1 4
getYear() Returns the year, as a two/three/four digit number, depending on the browser. Use the getFullYear() method instead! 1 3
parse() Takes a date string and returns the number of milliseconds since midnight of January 1, 1970 1 3
setDate() Sets the day of the month in a Date object (from 1-31) 1 3
setFullYear() Sets the year in a Date object (four digits) 1 4
setHours() Sets the hour in a Date object (from 0-23) 1 3
setMilliseconds() Sets the milliseconds in a Date object (from 0-999) 1 4
setMinutes() Set the minutes in a Date object (from 0-59) 1 3
setMonth() Sets the month in a Date object (from 0-11) 1 3
setSeconds() Sets the seconds in a Date object (from 0-59) 1 3
setTime() Calculates a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970 1 3
setUTCDate() Sets the day of the month in a Date object according to universal time (from 1-31) 1 4
setUTCMonth() Sets the month in a Date object according to universal time (from 0-11) 1 4
setUTCFullYear() Sets the year in a Date object according to universal time (four digits) 1 4
setUTCHours() Sets the hour in a Date object according to universal time (from 0-23) 1 4
setUTCMinutes() Set the minutes in a Date object according to universal time (from 0-59) 1 4
setUTCSeconds() Set the seconds in a Date object according to universal time (from 0-59) 1 4
setUTCMilliseconds() Sets the milliseconds in a Date object according to universal time (from 0-999) 1 4
setYear() Sets the year in the Date object (two or four digits). Use the setFullYear() method instead! 1 3
toDateString() Converts the date portion of a Date object into a readable string    
toGMTString() Converts a date to a string (according to Greenwich time). Use the toUTCString() method instead! 1 3
toLocaleDateString() Converts a date to a string (according to local time) 1 4
toLocaleTimeString() Converts a time to a string (according to local time) 1 4
toLocaleString() Converts a Date object to a string (according to local time) 1 3
toSource() Represents the source code of an object 1 -
toString() Converts a Date object to a string 1 4
toTimeString() Converts the time portion of a Date object into a readable string    
toUTCString() Converts a date to a string (according to universal time) 1 4
UTC() Converts a date and returns the number of milliseconds since midnight of January 1, 1970 according to universal time 1 3
valueOf() Returns the primitive value of a Date object 1 4

« Previous Next Chapter »


Make your web applications look like a million bucks

FusionCharts   

Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.

FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc. and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our 12,000 customers and 150,000 users which include a majority of the Fortune 500 companies. And yeah, your applications could look like a million bucks by spending just $69.

So go ahead, download your copy of FusionCharts and start "wow-ing" your customers now!



W3Schools Certification

W3Schools' Online Certification Program

The perfect solution for professionals who need to balance work, family, and career building.

More than 4000 certificates already issued!

The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.

The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.

The XML Certificate documents your knowledge of XML, XML DOM and XSLT.

The ASP Certificate documents your knowledge of ASP, SQL, and ADO.

The PHP Certificate documents your knowledge of PHP and SQL (MySQL).

WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
Top Web Hosting
Windows Hosting
WEB BUILDING
XML Editor – Free Trial!
FREE Flash Website
FREE Web Templates
FLIGHT TICKETS
Find the cheapest flight
to any destination now!
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
STATISTICS
Browser Statistics
Browser OS
Browser Display