SO Help: How to get current date in JavaScript:Date.format

http://stackoverflow.com/questions/1531093/how-to-get-current-date-in-javascript/9229385#9229385

by SpYk3

HTML

<script src="https://cdn.rawgit.com/JDMcKinstry/JavaScriptDateFormat/master/Date.format.js"></script>
<p>
    <span>
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        		REMEMBER TO OPEN YOUR BROWSERS CONSOLE 
        		AND SEE THE OBJECTS REPRESENTING 
        		THE CLASS AND EVEN MORE EXAMPLES
        ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
    </span>
</p>
<hr />
<table>
    <thead>
        <tr>
            <th colspan="999">
                Built in DateTime Formats
                <br />
                <sub>
                    example: var aDate = new DateTime().format(mySQL);
                </sub>
            </th>
        </tr>
    </thead>
    <tbody id="formatRows"></tbody>
</table>

CSS

p span { display: none; }
table { text-align: center; width: 100%; }
table th { background: #000; color: #FFF; }
table th, table td { padding: 2px 4px; text-align: center; }
table td { border-bottom: 1px solid; }

JavaScript

var d = new Date(),
	formats = {
		compound: d.format('compound'),
		constants: d.format('constants'),
		pretty: d.format('pretty')
	}

$.each(formats, function(typ, frms) {
	$('#formatRows').append(
		$('<tr />').append(
			$('<td />', { 'colspan': 999, text: typ }).css({ 'font-weight': 'bold', 'padding-left': '8px', 'text-align': 'left' })
		)
	);
	$.each(frms, function(name, value) {
		$('#formatRows').append(
			$('<tr />').append(
				$('<td />').css({ 'text-align': 'right' }).text(name),
				$('<td />').css({ 'border-left': '1px solid', 'border-right': '1px solid', 'padding': '0px 1px' }),
				$('<td />').css({ 'text-align': 'left' }).text(value)
			)
		);
	})
});

/*    See your browsers console for an object of this class and see all its features in full    */
console.log("Using Miliseconds: \t\t\t\t\t\t\t\t", new Date(1356155999999).format('pretty-b'));
console.log("Using Date String (if valid): \t\t\t\t\t", new Date('12/31/1999 11:59:59').format('pretty-b'));
console.log("Using Hard Values (year, month, day, etc...): \t", new Date(1999, 11, 31).format('pretty-b'));