JavaScript | Static Current Date Format

<script type="text/javascript">
var today = new Date();
var d = today.getDate();
var m = today.getMonth();
var y = today.getFullYear();
var months = new Array("January", "February", "March", "April", "May", "June", "Jully", "August", "September", "October", "November", "December");
datestr = months[m] + " " + d + ", " + y;
document.write(datestr);
</script>

This displays always "Month Day, Year", regardless of user browser language, or system regional settings.

The code can be added in-line, where it is needed within the html.

Comments

Popular posts from this blog

Breaking down document locking in SharePoint

Document ID not being generated

Open Office documents in any browser using Office URI scheme