W3Schools

home HOME

JS Reference
JS Overview
JS Array
JS Boolean
JS Date
JS Math
JS Number
JS String
JS RegExp
JS Functions
JS Events

DOM Objects
DOM Window
DOM Navigator
DOM Screen
DOM History
DOM Location

DOM Document

DOM Anchor
DOM Area
DOM Base
DOM Body
DOM Button
DOM Event
DOM Form
DOM Frame
DOM Frameset
DOM IFrame
DOM Image
DOM Input Button
DOM Input Checkbox
DOM Input File
DOM Input Hidden
DOM Input Password
DOM Input Radio
DOM Input Reset
DOM Input Submit
DOM Input Text
DOM Link
DOM Meta
DOM Object
DOM Option
DOM Select
DOM Style
DOM Table
DOM TableCell
DOM TableRow
DOM Textarea

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Forum

Helping W3Schools

JavaScript Date Object Reference


Date Object Methods

FF: Firefox, N: Netscape, IE: Internet Explorer

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


Date Object Properties

Property Description FF N IE 
constructor A reference to the function that created the object 1 4 4
prototype Allows you to add properties and methods to the object 1 3 4



Altova® XMLSpy® - The world's best-selling XML editor!

Whether you're new to XML or already an advanced user, the user-friendly views and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to meet your XML and Web services development needs from start to finish.

  • XML editor
  • Graphical XML Schema / DTD editors
  • XSLT 1.0/2.0 editor, debugger, profiler
  • XQuery editor, debugger, profiler
  • Support for Office Open XML (OOXML)
  • Graphical WSDL editor & SOAP debugger
  • Java, C#, C++ code generation
  • And much more!

Download a free 30-day trial today!

Click to see a demo!

Learn what’s new in v2008




diploma   

Get Your Diploma!

W3Schools' Online Certification Program is the perfect solution for busy professionals who need to balance work, family, and career building.

The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.

The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.



Jump to: Top of Page or HOME or Printer Friendly Printer friendly page

W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2008 by Refsnes Data. All Rights Reserved.

Validate Validate W3C-WAI level A conformance icon W3Schools was converted to XHTML in December 1999
SITE SEARCH
 
About W3Schools
W3Schools Forum
Web charting
Web based charting
for ASP.NET
WEB HOSTING
$15 Domain Name
Registration
Save $20 / year!
UK Domain Names
UK Web Hosting

Alojamiento Web
Buy UK Domain Names
Register Domain Names
Cheap Domain Names
Cheap Web Hosting
Best Web Hosting
Domain Name Registration
PHP MySQL Hosting
Top 10 Web Hosting
Web Hosting Providers
Web Hosting Company
UK Web Hosting
UK Reseller Hosting
Web Hosting
WEB BUILDING
Website Templates
Flash Templates
Website Builder
Internet Business Opportunity
Custom Programming
FREE Trial or Demo
Web Content Manager
Forms,Web Alerts,RSS
Ecommerce Software
Learn XML with XMLSpy®
Azbuz Blog
SHOPPING
UK Wholesalers
UK Wholesale
UAE Dubai Property
Private Student Loans
UK Dropshippers & Wholesalers Directory
EDUCATION
US Web Design Schools
HTML Exam
YELLOW PAGES
www.nettkatalogen.no
www.gulex.dk
www.gulex.se
www.gelbex.de
www.teloos.fi
www.teloos.fr
www.teloos.co.uk
www.teloos.at
www.teloos.de