Your SlideShare is downloading. ×
Date functions in javascript
Date functions in javascript
Date functions in javascript
Date functions in javascript
Date functions in javascript
Date functions in javascript
Date functions in javascript
Date functions in javascript
Date functions in javascript
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Date functions in javascript

82

Published on

Date functions in javascript

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
82
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Date Functions in Javascript Typing Speed: Ismail Ismailpk456@gmail.com Ismail Ismu Ismail Ismu in.linkedin.com/in/profilena me 8086303494
  • 2. Date Object The Date object is used to work with dates and times. Date objects are created with the Date() constructor.
  • 3. Examples Get today's date. <html> <body> <script> var d=new Date(); document.write(d); </script> </body> </html>
  • 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. 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. 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. 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. THE END

×