Skip to content

Instantly share code, notes, and snippets.

@momin-riyadh
Last active October 25, 2015 14:48
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 momin-riyadh/b048a465f8535874e9f6 to your computer and use it in GitHub Desktop.
Save momin-riyadh/b048a465f8535874e9f6 to your computer and use it in GitHub Desktop.
Javascript [Date/Time(options)]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<p>Today Is :<br><span class="date"></span></p>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="script.js"></script>
</body>
</html>
var date = new Date();
options = {
year: 'numeric', month: 'long', day: 'numeric',
hour: 'numeric', minute: 'numeric', second: 'numeric',
hour12: true
};
var today = (date.toLocaleString('en-US', options));
$(function(){
$('.date').text(today);
});
.date{
background: #8c8c8c;
padding: 5px;
margin-top: 10px;
display: block;
color:white;
font-weight:bold;
text-transform: uppercase;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment