{"id":363,"date":"2012-03-08T06:18:03","date_gmt":"2012-03-08T06:18:03","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=363"},"modified":"2012-03-08T06:18:03","modified_gmt":"2012-03-08T06:18:03","slug":"javascript-add-minutes-to-date","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/javascript-add-minutes-to-date\/","title":{"rendered":"Javascript Add minutes to date Example"},"content":{"rendered":"<p>In this article, I am going to discuss about\u00a0Javascript: Add minutes to date i.e how to add any number of minutes to a date.<!--more--><\/p>\n<h2>Example to Add minutes to date using\u00a0JavaScript<\/h2>\n<p>Here is a simple example that shows how to add minutes to date using JavaScript:<\/p>\n<pre class=\"lang:xhtml decode:true crayon-selected\">&lt;script language=\"javascript\" type=\"text\/javascript\"&gt;\n\/\/The current date\nvar date = new Date ();\n\/\/New\/future date\nvar new_date = new Date ( date );\n\/\/Minutes to add_action. Change this as required\nvar minutes = 60;\n\/\/Add the minutes to current date to arrive at the new date\nnew_date.setMinutes ( date.getMinutes() + minutes );\n\/\/Output the old + new date\ndocument.write('Old Date: ' + date + '&lt;br \/&gt; New Date:' + new_date);\n\/\/Output is:\n\/\/Old Date: Thu Mar 08 2012 11:42:11\n\/\/New Date: Thu Mar 08 2012 12:42:11\n\/\/Note: The above values also shows the Timezone, but I have removed it for simplicity from the example\n\n\/\/If you do not want to show the current date but need to show only the new date, then this can be further simplified as:\nvar revised_date = new Date();\nrevised_date.setMinutes(revised_date.getMinutes() + minutes);\ndocument.write('&lt;br \/&gt; ' + revised_date);\n\/\/Output is Thu Mar 08 2012 12:42:11\n&lt;\/script&gt;<\/pre>\n<h5>Simple, isnt&#8217; it?<\/h5>\n<p>Do you know of any other ways to <strong>Add minutes to date\u00a0 using JavaScript<\/strong>? Feel free to suggest by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, I am going to discuss about\u00a0Javascript: Add minutes to date i.e how to add any number of minutes to a date.<\/p>\n","protected":false},"author":1,"featured_media":352,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,13],"tags":[35],"class_list":["post-363","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript-tips-and-tricks","category-tips-and-tricks","tag-javascript-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-5R","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=363"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/363\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}