{"id":79,"date":"2008-09-16T19:09:27","date_gmt":"2008-09-17T00:09:27","guid":{"rendered":"http:\/\/www.timrosenblatt.com\/blog\/2008\/09\/16\/javascript-dates-times-and-one-mans-dream\/"},"modified":"2008-09-16T19:09:27","modified_gmt":"2008-09-17T00:09:27","slug":"javascript-dates-times-and-one-mans-dream","status":"publish","type":"post","link":"http:\/\/www.timrosenblatt.com\/blog\/2008\/09\/16\/javascript-dates-times-and-one-mans-dream\/","title":{"rendered":"Javascript, Dates, Times, and One Man&#8217;s Dream"},"content":{"rendered":"<p>OK, so the title of this post might be a bit overstating.<\/p>\n<p>But, if you work with Javascript and need to use dates\/times, you should absolutely check out a <a href=\"http:\/\/blog.stevenlevithan.com\/archives\/date-time-format\">JS library for formatted dates and times<\/a> by Steven Levithan (who is obviously cool; his blog is titled &#8220;Flagrant Badassery&#8221;).<\/p>\n<p>It&#8217;s a library that extends the stock Date object in Javascript to let you easily generate nicely formatted dates. Just put the code in a file and load it up. Then you can do neat things like this (adapted from his blog)<\/p>\n<blockquote><p>var now = new Date();<\/p>\n<p>now.format(&#8220;m\/dd\/yy&#8221;);<br \/>\n\/\/ Returns, e.g., <strong>6\/09\/07<\/strong><\/p>\n<p>\/\/ You can use one of several named masks<br \/>\nnow.format(&#8220;isoDateTime&#8221;);<br \/>\n\/\/ <strong>2007-06-09T17:46:21<\/strong><\/p>\n<p>\/\/ &#8230;Or add your own<br \/>\ndateFormat.masks.hammerTime = &#8216;HH:MM! &#8220;Can\\&#8217;t touch this!&#8221;&#8216;;<br \/>\nnow.format(&#8220;hammerTime&#8221;);<br \/>\n\/\/ <strong>17:46! Can&#8217;t touch this!<\/strong><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>OK, so the title of this post might be a bit overstating. But, if you work with Javascript and need to use dates\/times, you should absolutely check out a JS library for formatted dates and times by Steven Levithan (who is obviously cool; his blog is titled &#8220;Flagrant Badassery&#8221;). It&#8217;s a library that extends the &hellip; <a href=\"http:\/\/www.timrosenblatt.com\/blog\/2008\/09\/16\/javascript-dates-times-and-one-mans-dream\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Javascript, Dates, Times, and One Man&#8217;s Dream&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[145,123],"tags":[242,245,579,243,244],"_links":{"self":[{"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/posts\/79"}],"collection":[{"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":0,"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.timrosenblatt.com\/blog\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}