Snap Builder Public Codes Library
Snap | Generators | Login | Browse | Search | Enter Code | Export Snap Builder Public Codes Library

 

Category: Javascript Codes Library >> Clocks & Timers >> Print Day, Date, Month & Year


Code Snippet </> Info


Snippet Name: Print Day, Date, Month & Year

Description: Print the Day, Date, Month & Year with this nifty code snippet.

Compatible Browsers:
Chrome BrowserFirefox BrowserInternet Explorer BrowserOpera BrowserSafari Browser


Example: View Code Demo

Note:

Author: Sandeep Gangadharan

Last Modified: 2019-12-09 02:23:38

Language: javascript

Highlight Mode: javascript

Copy Codes: Use Free Notepad ++
Bookmark and Share

Snap HTML Code Editor:
Paste the source code, make changes and instantly see it in live preview.
Snap HTML Code Editor


  About Copying
Copied To Clipboard!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Print Day, Date, Month & Year Javascript Code Snippet</title> <style> BODY {font-family:verdana,arial,ms sans serif; font-size:90%;} </style> <script> <!-- /* Begin Print Day, Date, Month & Year == This Script Free To Use Providing This Notice Remains == == This Script Has Been Found In The https://snapbuilder.com Free Public Codes Library == == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == == Created by: Sandeep Gangadharan : http://sivamdesign.com/scripts/ : Creative Commons License == == Modified by: SnapBuilder.com == */ var month = new Array(); month[0]="January"; month[1]="February"; month[2]="March"; month[3]="April"; month[4]="May"; month[5]="June"; month[6]="July"; month[7]="August"; month[8]="September"; month[9]="October"; month[10]="November"; month[11]="December"; var day = new Array(); day[0]="Sunday"; day[1]="Monday"; day[2]="Tuesday"; day[3]="Wednesday"; day[4]="Thursday"; day[5]="Friday"; day[6]="Saturday"; today = new Date(); date = today.getDate(); day = (day[today.getDay()]); month = (month[today.getMonth()]); year = (today.getFullYear()); suffix = (date==1 || date==21 || date==31) ? "st" : "th" && (date==2 || date==22) ? "nd" : "th" && (date==3 || date==23) ? "rd" : "th" function print_date() { document.write(day + "," + "" + date + "<sup>" + suffix + "</sup>" + "of" + month + "," + "" + year); } // --> </script> </head> <body> <h3><strong>Example:</strong></h3> <script>print_date();</script> <p>Place the <script>print_date();</script> where you want the date to appear on your web page.</p> </body> </html>


[ Snippet Options ]

 

© 2002 -  Snap Builder Public Codes Library