Time and Date Scripts | JavaScriptSource

Time and Date Scripts

These scripts all relate to time and dates. Some of them display only the month, others the entire year. Some highlight the current day or tell you when you entered the page. Other scripts display the current date or time according to the user's time zone, or another time zone some other place in the world. The source code is available for all the scripts.

Visit The JavaScript Forum for help coding scripts or general questions about the scripts themselves.

  • Stop Watch = Elapsed Time + Clock by Robert Ernster
    Robert Ernster Aug 2, 2012

    Stop Watch times any event in days : hours : minutes : seconds.

  • Calendar by Anup Khandelwal
    Anup Khandelwal May 22, 2012

    If you need a simple, elegant calendar to display the current days of the month, Basic Calendar is an excellent script for the purpose. Uses CSS to allow easy changing to its appearance, everything from calendar dimensions, colors, down to the font used to highlight the current day.

  • Alarm by Divyanshu Kalra
    Divyanshu Kalra Apr 5, 2012

    Set a alarm!

  • Good Morning, Afternoon, and Evening by Brad Jones
    Brad Jones Mar 19, 2012

    Adjust your message based on the time. See an example of saying Good Morning, Good Afternoon, or Good Evening based on the time of the day.

  • Determine Page Update Date by Brad Jones
    Brad Jones Mar 19, 2012

    Automatically display the date when the page was last updated. This super simple JavaScript call will give you that date.

  • Auto Expire
    Scott Clark Oct 3, 2010

    "Set ""go live"" and ""expire"" dates for content, such as ""Latest News"" or various promotional content."

  • Dynamic Timed Redirect
    Scott Clark Apr 14, 2010

    Redirect the user to a different Web page after a designated number of seconds.

  • Button Ticker
    Scott Clark Mar 31, 2010

    This is a cross browser javascript button ticker that ticks a number of messages on a button.

  • Date and Time of Last Visit
    Scott Clark Mar 24, 2010

    Display the date and time of the users last visit.

  • Double StopWatch
    Scott Clark Mar 24, 2010

    This script uses two stopwatches, one in seconds and one in ms.

  • Auto Expire
    Scott Clark Mar 17, 2010

    "Set ""go live"" and ""expire"" dates for content, such as ""Latest News"" or various promotional content."

  • Basic Date Display
    Scott Clark Mar 17, 2010

    Display today's date on your page.

  • Basic Date Display
    Scott Clark Mar 3, 2010

    Use this code snippet to display today's date on your Web page.

  • Month Page
    Scott Clark Dec 11, 2009

    The script determines the current month and sends them to the correct page.

  • Time Picker with child window
    R. Zohdy Bassem Sep 8, 2009

    This JavaScript code - date picker helps you choose a time through a popup window. Perhaps this feature is not new, but you can customize this calendar control code to create new effects that require the controls through another window page.

  • Born on This Day
    Scott Clark Aug 27, 2009

    What day of the week you were born on?

  • Time of Day Picture Change
    William Clark Aug 19, 2009

    Change a picture based on the time.

  • Time Spent on Page
    William Clark Aug 19, 2009

    Show your visitors how long they've been on your page!

  • Simple Date Format library
    Phong Thai Cao Mar 14, 2009

    This library can help you format a date object to a string or vice versa by very simple functions.

  • Day of Week
    Alexei Kourbatov Dec 10, 2008

    Use this script to calculate what day of the week a given date occurred. Can be used for past or future dates.

  • Reoccurring Events Monthly Calendar
    Shaun Bailey Nov 19, 2008

    Features include one time, weekly, monthly, and annual events. Monthly navigation uses links or a dropdown list.

  • Auto Expire
    Don Demrow Aug 11, 2008

    Set "go live" and "expire" dates for content, such as "Latest News" or various promotional content. Great for when you don't have time to remember to go back and take old content down, or when you want to create content and have it go live at a later date.

  • End of Week Date Lookup
    Jake Aitchison Jun 30, 2008

    Use this script to display the date of the end of the week for any given period during the year. Fully customizable and easy to use.

  • Check for Leap Year
    Apr 21, 2008

    This snippet will check whether a date belongs to a leap year. Easy to add to an existing script.

  • Time of Day Picture Change
    Mar 28, 2008

    Use this script to change a picture (or banner) depending on the time of the day. Very simple to use!