{"id":310,"date":"2010-10-04T14:19:29","date_gmt":"2010-10-04T03:19:29","guid":{"rendered":"http:\/\/threemillion.net\/blog\/?p=310"},"modified":"2018-08-10T13:17:01","modified_gmt":"2018-08-10T03:17:01","slug":"iso-format-dates","status":"publish","type":"post","link":"https:\/\/threemillion.net\/blog\/?p=310","title":{"rendered":"ISO format dates"},"content":{"rendered":"<p>I often create file names such as logs with the current date and was tired of having to create the date string for all my scripts, so created these quick functions which I added to my Profile.<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">function Get-ISODate { Get-Date -UFormat &quot;%Y-%m-%d&quot; }<\/pre>\n<p>I also use the following when requiring a further level of detail.<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nfunction Get-ISODateTime { Get-Date -uFormat &quot;%Y-%m-%d-%H-%M-%S&quot; }\r\n<\/pre>\n<p>Example usage:<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n[string]$path = &quot;D:\\LogFiles\\&quot;\r\n[string]$logfile = &quot;$path$(Get-ISODate).log&quot;\r\n$logfile\r\nD:\\LogFiles\\2010-10-03.log\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I often create file names such as logs with the current date and was tired of having to create the date string for all my scripts, so created these quick <a href=\"https:\/\/threemillion.net\/blog\/?p=310\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":""},"categories":[8,5],"tags":[],"_links":{"self":[{"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/310"}],"collection":[{"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=310"}],"version-history":[{"count":10,"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions"}],"predecessor-version":[{"id":793,"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions\/793"}],"wp:attachment":[{"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/threemillion.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}