{"id":191,"date":"2016-12-10T14:02:00","date_gmt":"2016-12-10T14:02:00","guid":{"rendered":"http:\/\/rat32.com\/rat32\/?p=191"},"modified":"2016-12-10T14:02:00","modified_gmt":"2016-12-10T14:02:00","slug":"javascript-new-date-not-working-in-iphone-and-android-devices-with-nan-and-undefined-error","status":"publish","type":"post","link":"https:\/\/rat32.com\/rat32\/2016\/12\/10\/javascript-new-date-not-working-in-iphone-and-android-devices-with-nan-and-undefined-error\/","title":{"rendered":"javascript new date not working in iphone and android devices with NAN and Undefined error"},"content":{"rendered":"<p>Today i found a new problem, the date object working perfectly in desktop web browsers but not working in android browsers and iphone browsers. The problem is they issue NAN and Undefined errors.  So what is the universal solution? There is a simple solution to the problem. You should declare date as following format:<\/p>\n<pre class=\"lang:js decode:true \" >var date1 = new Date(\"2016-12-10 07:42\");<\/pre>\n<p>If you are processing date from php then the format for php date is:<\/p>\n<pre class=\"lang:php decode:true \" >echo \"&lt;script&gt;var date1 = \\\"\".date('Y\/m\/d H:i:s').\"\\\";&lt;\/script&gt;\";<\/pre>\n<p>Hope this technique works for web browsers in desktop and mobile devices.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Today i found a new problem, the date object working perfectly in desktop web browsers but not working in android browsers and iphone browsers. The problem is they issue NAN and Undefined errors. So&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73,7,41,45,3],"tags":[114,111,63,112,113],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-android","category-how-to","category-ios","category-javascript","category-php","tag-browsers","tag-date","tag-javascript-2","tag-nan","tag-undefined"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/191"}],"collection":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":1,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"predecessor-version":[{"id":192,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/191\/revisions\/192"}],"wp:attachment":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}