{"id":33,"date":"2010-03-04T20:54:48","date_gmt":"2010-03-04T17:54:48","guid":{"rendered":"http:\/\/meekconsulting.com\/?p=33"},"modified":"2010-03-04T20:55:21","modified_gmt":"2010-03-04T17:55:21","slug":"converting-julian-date-to-real-date-in-mysql","status":"publish","type":"post","link":"https:\/\/meekconsulting.com\/?p=33","title":{"rendered":"converting julian date to real date in mysql"},"content":{"rendered":"<p>We\u2019ve got data that uses a funky date format \u2014 not a true julian date\u00a0 but the Year followed by the DAY of the year.<\/p>\n<p>i.e.<\/p>\n<p>2010005 = January 5th, 2010<\/p>\n<p>2010031 = January 31st 2010<\/p>\n<p>2010365 = December 31st 2010<\/p>\n<p>This little snippet of code will allow you to select it from the mysql database and convert it to a real date.<\/p>\n<blockquote><p>select date_sub(date_add(concat(substr(jdate,1,4),\u2019-01-01\u2032), interval  substr(jdate,5,3) day ), interval 1 day)<\/p><\/blockquote>\n<p>so in this example below returns May 2 ( the 123rd day of 2004 is May 2 )<\/p>\n<blockquote><p>select date_sub(date_add(concat(substr(\u20182004123\u2032,1,4),\u2019-01-01\u2032), interval substr(\u20182004123\u2019,5,3) day ), interval 1 day)<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ve got data that uses a funky date format \u2014 not a true julian date\u00a0 but the Year followed by the DAY of the year. i.e. 2010005 = January 5th, 2010 2010031 = January 31st 2010 2010365 = December 31st &hellip; <a href=\"https:\/\/meekconsulting.com\/?p=33\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/33"}],"collection":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":2,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":35,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions\/35"}],"wp:attachment":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}