Date Functions in Javascript
Typing Speed:

Ismail
Ismailpk456@gmail.com
Ismail Ismu
Ismail Ismu
in.linkedin.com/in/profil...
Date Object
The Date object is used to work with dates and times.
Date objects are created with the Date() constructor.
Examples
Get today's date.
<html>
<body>
<script>
var d=new Date();
document.write(d);

</script>
</body>
</html>
Display Todays day of the week
<html>
<body>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()...
Compares today's date with the 14th January 2012
<html>
<script>
var x=new Date();
x.setFullYear(2012,01,14);
var today = ...
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.

Thanks in advance.
www.baabtra.c...
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550

Start up Vil...
THE END
Date functions in javascript
Upcoming SlideShare
Loading in...5
×

Date functions in javascript

90

Published on

Date functions in javascript

Published in: Education, Technology, Travel
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
90
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Date functions in javascript

  1. 1. Date Functions in Javascript Typing Speed: Ismail Ismailpk456@gmail.com Ismail Ismu Ismail Ismu in.linkedin.com/in/profilena me 8086303494
  2. 2. Date Object The Date object is used to work with dates and times. Date objects are created with the Date() constructor.
  3. 3. Examples Get today's date. <html> <body> <script> var d=new Date(); document.write(d); </script> </body> </html>
  4. 4. Display Todays day of the week <html> <body> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var d = new Date(); var weekday=new Array(7); weekday[0]="Sunday"; weekday[1]="Monday"; weekday[2]="Tuesday"; weekday[3]="Wednesday"; weekday[4]="Thursday"; weekday[5]="Friday"; weekday[6]="Saturday"; var x = document.getElementById("demo"); x.innerHTML=weekday[d.getDay()]; } </script> </body> </html>
  5. 5. Compares today's date with the 14th January 2012 <html> <script> var x=new Date(); x.setFullYear(2012,01,14); var today = new Date(); if (x>today) { alert("Today is before 14th January 2012"); } else { alert("Today is after 14th January 2012"); } </script> </html>
  6. 6. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  7. 7. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550
  8. 8. THE END
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×