chadlindstrom.ca

Adventurer, Web Developer, Photographer, Athlete and goofball




JavaScript Time Functions

Example demonstrating a JavaScript time functions.

The JavaScript

var now = new Date(); var myDate = new Date( 1495790438 ); $(document).ready(function() { $("#nowDate").html( now.getTime() ); $("#myDate").html( myDate.getTime() + " " + myDate.toDateString() + " " + myDate.toLocaleDateString() + " " + myDate.toString() ); });

The Markup

The Output

JS NowDate.getTime=

JS MyDate.getTime=