{"id":8538,"date":"2017-04-21T09:00:18","date_gmt":"2017-04-21T13:00:18","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=8538"},"modified":"2017-04-21T10:42:09","modified_gmt":"2017-04-21T14:42:09","slug":"parsetime","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2017\/04\/21\/parsetime\/","title":{"rendered":"parseTime"},"content":{"rendered":"<p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/76890\">Will<\/a>&#8216;s pick this week is <a href=https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/52831-parsetime\">parseTime<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/5905889-robert\">Robert<\/a>.<\/p>\n<p>Sometimes it&#8217;s something simple that ends up being the most handy. I can&#8217;t tell you how many times I&#8217;ve run a simulation whose base unit of time is seconds. For long simulations, you end up with some rather big numbers. At that point, it&#8217;s often more useful to think of the values in hours, days, and\/or years. And so I end up at the MATLAB Command Window typing t\/60\/60\/24&#8230;<\/p>\n<p>MATLAB&#8217;s <a href=\"https:\/\/www.mathworks.com\/videos\/date-and-time-arrays-95317.html\">datetime data type<\/a> has drastically simplified a lot of my time-related analysis tasks. However, I still find myself running my quick conversions on double-precision numbers. That&#8217;s where parseTime comes in. This no-frills function returns the equivalent years, weeks, days, hours, minutes, and seconds.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/will_campbell\/potw_parseTime\/parseTime_output.png\" alt=\"parseTime Output\" \/><\/center><\/p>\n<p>I&#8217;ll be adding this function to my path and expect to be invoking it regularly. The one thing I&#8217;d like added is support for arrays. It&#8217;s a small modification that most MATLAB programmers should be able to achieve on their own.<\/p>\n<p>Let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=8538#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/52831-parsetime#comments\">comment<\/a> for Robert.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/will_campbell\/potw_parseTime\/parseTime_output.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Will&#8216;s pick this week is&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2017\/04\/21\/parsetime\/\">read more >><\/a><\/p>\n","protected":false},"author":45,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,28],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8538"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=8538"}],"version-history":[{"count":4,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8538\/revisions"}],"predecessor-version":[{"id":8817,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8538\/revisions\/8817"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=8538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=8538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=8538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}