{"id":18756,"date":"2020-07-01T02:29:44","date_gmt":"2020-07-01T09:29:44","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=18756"},"modified":"2023-12-01T03:37:43","modified_gmt":"2023-12-01T11:37:43","slug":"javascript-date","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-date\/","title":{"rendered":"JavaScript Date and Time: A Guide for Beginners"},"content":{"rendered":"\n<p>There\u2019s no escaping the clock, especially in programming. Just as we rely on clocks and watches to keep track of our days, so do programs use time-tracking tools to know what should happen and when.<br><\/p>\n\n\n\n<p>Several applications need to track time. A blog application needs to remember when a post was created, whereas a calendar application displays your scheduled events.<br><\/p>\n\n\n\n<p>In this guide, we discuss how to work with the date and time in JavaScript. We\u2019ll walk you through a few examples to illustrate how to work with these tools.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is the JavaScript Date Object?<\/h2>\n\n\n\n<p>To work with time in JavaScript, we use the Date object. This is a special object that stores the date and time. What\u2019s more, the Date object comes with a range of methods that we can use to retrieve particular pieces of information about the date and time.<br><\/p>\n\n\n\n<p>The date object looks like this:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>new Date();<\/pre><\/div>\n\n\n\n<p>In this tutorial, you\u2019ll notice that Date is capitalized. This is because Date is a built-in JavaScript object. You have to capitalize the word Date to work with the date object.&nbsp;<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Use the Date Object<\/h2>\n\n\n\n<p>Without any values, the Date object tells us the current date and time. This is calculated based on your operating system\u2019s settings and taking your timezone into account.<br><\/p>\n\n\n\n<p>We can use the Date object to retrieve the current date, like this:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var currentDate = new Date();\nconsole.log(currentDate);<\/pre><\/div>\n\n\n\n<p>Our code returns a Date object which contains the following values:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Wed Jun 24 2020 10:49:46 GMT+0100 (British Summer Time)<\/pre><\/div>\n\n\n\n<p>As you can see, this article was written in the UK on June 24, 2020, as our timestamp shows. The beauty of the Date object is that it returns data in a human-readable date format so that it is easy for us to understand.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Retrieving a Timestamp Using Date<\/h2>\n\n\n\n<p>The above code is readable to us humans, but there\u2019s a problem\u2014JavaScript works differently. It interprets dates using a Unix timestamp. Unix timestamps keep count of how many seconds have passed since January 1, 1970. This is when Unix time began.<br><\/p>\n\n\n\n<p>To retrieve the current time as a timestamp, you can use the <code>getTime()<\/code> method:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var currentDate = new Date();\nconsole.log(currentDate.getTime());<\/pre><\/div>\n\n\n\n<p>Our code returns <code>1592992393313<\/code>, a number that can be interpreted by JavaScript.&nbsp;<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating a Date Object<\/h2>\n\n\n\n<p>The default value of the Date object is the current date and time. You can change this to create a date based on a particular timestamp or date and time.<br><\/p>\n\n\n\n<p>You can do this by specifying either a timestamp, a date string, or a set of numbers that correspond to the current date and time:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>new Date(timestamp)<\/li>\n\n\n\n<li>new Date(string)<\/li>\n\n\n\n<li>new Date(year, month, day, hours, minutes, seconds, number of milliseconds)<\/li>\n<\/ul>\n\n\n\n<p>Suppose we want to create a timestamp for January 1, 2021. We could do so using this code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var nextYear = new Date(\"January 1 2021 12:00\");\nconsole.log(nextYear);<\/pre><\/div>\n\n\n\n<p>Our code returns: Fri Jan 01 2021 12:00:00 GMT+0000 (Greenwich Mean Time)<br><\/p>\n\n\n\n<p>We could also have created this timestamp using these lines of code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var nextYear = new Date(1609502400000);\nconsole.log(nextYear);\nvar nextYear = new Date(2021, 1, 1, 0, 0, 0, 0);\nconsole.log(nextYear);<\/pre><\/div>\n\n\n\n<p>Our code returns:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Fri Jan 01 2021 12:00:00 GMT+0000 (Greenwich Mean Time)\nFri Jan 01 2021 12:00:00 GMT+0000 (Greenwich Mean Time)<\/pre><\/div>\n\n\n\n<p>All of these methods create the same Date object.&nbsp;<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Retrieving the Date<\/h2>\n\n\n\n<p>The Date object comes with an array of built-in methods to access particular pieces of information about the date. The methods that allow you to retrieve information about the date start with <code>get<\/code>. Here\u2019s a list for your reference:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Year: getFullYear()<\/li>\n\n\n\n<li>Month: getMonth() (between 0 and 11, where 0 is January)<\/li>\n\n\n\n<li>Day of the Month: getDate() (between 1 and 31)<\/li>\n\n\n\n<li>Day of the Week: getDay() (between 0 and 6, where Sunday is 0)<\/li>\n\n\n\n<li>Hour: getHours() (between 0 and 23, where midnight is 0)<\/li>\n\n\n\n<li>Minute: getMinutes()<\/li>\n\n\n\n<li>Second: getSeconds()<\/li>\n\n\n\n<li>Millisecond: getMilliseconds()<\/li>\n\n\n\n<li>Timestamp: getTime()<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s say we want to find out what time it is right now. We could do so using this code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const currentDate = new Date();\nconsole.log(currentDate.getHours());<\/pre><\/div>\n\n\n\n<p>Our code returns <code>11<\/code>. This shows us that it&#8217;s currently 11 hours into the day.<br><\/p>\n\n\n\n<p>These functions are useful because they help us extract specific pieces of information about the day. We don&#8217;t need to worry about manipulating any strings; we can just use the <code>get<\/code> methods to learn more about the current time.<br><\/p>\n\n\n\n<p>You can retrieve a timestamp using Universal Time Coordinated (UTC) by adding <code>UTC<\/code> between the word <code>get<\/code> and the date value. By default, the Date object will return information in a user&#8217;s local timezone. If you are working with users in multiple time zones, it&#8217;s often best to use UTC to track the time events happen easily.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Updating a Date Object<\/h2>\n\n\n\n<p>Date objects can be updated using the Date <code>set<\/code> methods. There is a <code>set<\/code> method for every <code>get<\/code> method offered by the Date object:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Year: setFullYear()<\/li>\n\n\n\n<li>Month: setMonth()<\/li>\n\n\n\n<li>Day of the Month: setDate()<\/li>\n\n\n\n<li>Day of the Week: setDay()<\/li>\n\n\n\n<li>Hour: setHours()<\/li>\n\n\n\n<li>Minute: setMinutes()<\/li>\n\n\n\n<li>Second: setSeconds()<\/li>\n\n\n\n<li>Millisecond: setMilliseconds()<\/li>\n\n\n\n<li>Timestamp: setTime()<\/li>\n<\/ul>\n\n\n\n<p>Suppose we want to find out what day of the week it was on this date last year. We could do so by setting the year on our Date object to 2019 using <code>setFullYear()<\/code>. Then, we can use <code>getDay()<\/code> to retrieve the day of the week:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const currentDate = new Date();\ncurrentDate.setFullYear(2019);\nconst daysOfTheWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', Saturday', Sunday'];\nconst dayLastYear = currentDate.getDay();\nconsole.log('On this day last year it was ' + daysOfTheWeek[dayLastYear]);<\/pre><\/div>\n\n\n\n<p>Our code returns: On this day last year it was Tuesday.<br><\/p>\n\n\n\n<p>We first use <code>Date()<\/code> to retrieve the current date. We then use the <code>setFullYear()<\/code> method to set the year on our date object to 2019.<br><\/p>\n\n\n\n<p>Next, we declare an array called <code>daysOfTheWeek<\/code>. This helps us convert the number returned by <code>getDay()<\/code> into a day of the week.<br><\/p>\n\n\n\n<p>We then use the <code>getDay()<\/code> method to figure out what day of the week it was this time in 2019. Then, we print out the message <code>On this day last year it was<\/code> followed by the day of the week.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Using the Date object you can work with dates and times in JavaScript. The Date object comes with a range of <code>get<\/code> methods which help you learn about the current time and <code>set<\/code> methods to manipulate date and time objects. Now you\u2019re ready to start working with the date and time in JavaScript like an expert!<\/p>\n","protected":false},"excerpt":{"rendered":"There\u2019s no escaping the clock, especially in programming. Just as we rely on clocks and watches to keep track of our days, so do programs use time-tracking tools to know what should happen and when. Several applications need to track time. A blog application needs to remember when a post was created, whereas a calendar&hellip;","protected":false},"author":240,"featured_media":18757,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-18756","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"JavaScript","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JavaScript Date and Time: A Guide for Beginners | Career Karma<\/title>\n<meta name=\"description\" content=\"The JavaScript Date object allows you to work with the date and time in your code. On Career Karma, learn how to use the Date object.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/javascript-date\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Date and Time: A Guide for Beginners\" \/>\n<meta property=\"og:description\" content=\"The JavaScript Date object allows you to work with the date and time in your code. On Career Karma, learn how to use the Date object.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-date\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-01T09:29:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:37:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript Date and Time: A Guide for Beginners\",\"datePublished\":\"2020-07-01T09:29:44+00:00\",\"dateModified\":\"2023-12-01T11:37:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/\"},\"wordCount\":939,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/\",\"name\":\"JavaScript Date and Time: A Guide for Beginners | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg\",\"datePublished\":\"2020-07-01T09:29:44+00:00\",\"dateModified\":\"2023-12-01T11:37:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The JavaScript Date object allows you to work with the date and time in your code. On Career Karma, learn how to use the Date object.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-date\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript Date and Time: A Guide for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JavaScript Date and Time: A Guide for Beginners | Career Karma","description":"The JavaScript Date object allows you to work with the date and time in your code. On Career Karma, learn how to use the Date object.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/careerkarma.com\/blog\/javascript-date\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Date and Time: A Guide for Beginners","og_description":"The JavaScript Date object allows you to work with the date and time in your code. On Career Karma, learn how to use the Date object.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-date\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-01T09:29:44+00:00","article_modified_time":"2023-12-01T11:37:43+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript Date and Time: A Guide for Beginners","datePublished":"2020-07-01T09:29:44+00:00","dateModified":"2023-12-01T11:37:43+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/"},"wordCount":939,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-date\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/","url":"https:\/\/careerkarma.com\/blog\/javascript-date\/","name":"JavaScript Date and Time: A Guide for Beginners | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg","datePublished":"2020-07-01T09:29:44+00:00","dateModified":"2023-12-01T11:37:43+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The JavaScript Date object allows you to work with the date and time in your code. On Career Karma, learn how to use the Date object.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-date\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/oskar-yildiz-gy08FXeM2L4-unsplash.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-date\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/careerkarma.com\/blog\/javascript\/"},{"@type":"ListItem","position":3,"name":"JavaScript Date and Time: A Guide for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/18756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=18756"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/18756\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/18757"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=18756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=18756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=18756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}