Skip to content

Instantly share code, notes, and snippets.

@mariobox
Last active October 19, 2017 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariobox/6e1ad9ca38e2df5534b34b51a8310bde to your computer and use it in GitHub Desktop.
Save mariobox/6e1ad9ca38e2df5534b34b51a8310bde to your computer and use it in GitHub Desktop.
Last Updated Statement in User-Friendly Format
<!DOCTYPE html>
<html>
<head>
<title>Timestamp</title>
</head>
<!-- Start Page -->
<body>
<div>
<p id="lastUpdated"></p>
</div>
<!-- Custom JavaScript -->
<script src="lastupdated.js"></script>
</body>
</html>
var lastUpdated = new Date(document.lastModified);
var lastUpdatedString = lastUpdated.toString();
var lastUpdatedArray = lastUpdatedString.split(' ');
document.getElementById('lastUpdated').innerHTML = '<p><strong>Last updated: </strong>' + lastUpdatedArray[1] + ' ' + lastUpdatedArray[2] + ' ' + lastUpdatedArray[3] + '</p></strong>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment