{"id":23910,"date":"2024-02-02T18:00:36","date_gmt":"2024-02-02T10:00:36","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=23910"},"modified":"2024-02-02T11:37:45","modified_gmt":"2024-02-02T03:37:45","slug":"date-internationalization-api","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/","title":{"rendered":"A Comprehensive Guide on Date Formatting for Global Websites"},"content":{"rendered":"<p>Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these preferences is key to user engagement and international success. This guide dives into the effective use of <a href=\"https:\/\/ecma-international.org\/publications-and-standards\/standards\/ecma-402\/\">JavaScript\u2019s Internationalization API<\/a>, as defined by ECMA, for customizing date displays in various languages and cultural norms. Learn how to handle different date formats, currencies, and time zones with ease.<\/p>\n<p>Our focus: leveraging the Internationalization API for <strong>seamless and efficient date formatting<\/strong> across different languages and regions.<\/p>\n<div class=\"ref-block ref-block--post\" id=\"ref-post-1\">\n\t\t\t\t\t<a href=\"https:\/\/www.hongkiat.com\/blog\/time-date-web\/\" class=\"ref-block__link\" title=\"Read More: Display Date and Time: How to Do It Right\" rel=\"bookmark\"><span class=\"screen-reader-text\">Display Date and Time: How to Do It Right<\/span><\/a>\n<div class=\"ref-block__thumbnail img-thumb img-thumb--jumbo\" data-img='{ \"src\" : \"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/time-date-web.jpg\" }'>\n\t\t\t\t\t\t\t<noscript>\n<style>.no-js #ref-block-post-23989 .ref-block__thumbnail { background-image: url(\"https:\/\/assets.hongkiat.com\/uploads\/thumbs\/250x160\/time-date-web.jpg\"); }<\/style>\n<\/noscript>\n\t\t\t\t\t\t<\/div>\n<div class=\"ref-block__summary\">\n<h4 class=\"ref-title\">Display Date and Time: How to Do It Right<\/h4>\n<p class=\"ref-description\">\n\t\t\t\t\t\tWe come across them dates and time... well, every day. When it comes to the Web, you can...\t\t\t\t\t\t<span>Read more<\/span><\/p>\n<\/div>\n<\/div>\n<hr>\n<h2>Determining the User\u2019s Locale<\/h2>\n<p>To display the date in the user\u2019s preferred local format, it\u2019s important to first identify their locale. The most straightforward method is to allow users to choose their language and regional preferences on your webpage.<\/p>\n<p>If direct user selection isn\u2019t viable, other approaches include interpreting the <code>Accept-Language<\/code> header from user requests or utilizing the <code>navigator.language<\/code> (for Chrome and Firefox) or <code>navigator.browserLanguage<\/code> (for Internet Explorer) properties in JavaScript.<\/p>\n<p>However, it\u2019s important to note that these methods may not always accurately reflect the user\u2019s browser UI language preference.<\/p>\n<pre>\r\n var language_tag = window.navigator.browserLanguage || window.navigator.language || \"en\";\r\n \/\/ returns language tags like 'en-GB'\r\n <\/pre>\n<hr>\n<h2>Verifying Internationalization API Support<\/h2>\n<p>To determine if a browser supports the Internationalization API, we can check for the presence of the global <code>Intl<\/code> object.<\/p>\n<pre>\r\n if(window.hasOwnProperty(\"Intl\") && typeof Intl === \"object\"){\r\n \/\/ The Internationalization API is available for use\r\n } \r\n<\/pre>\n<hr>\n<h2>Exploring the <code>Intl<\/code> Object<\/h2>\n<p>The <code>Intl<\/code> object in JavaScript serves as a gateway to the Internationalization API. It contains three constructor properties: <code>Collator<\/code> for string comparison, <code>NumberFormat<\/code> for number formatting, and <code>DateTimeFormat<\/code> for date and time formatting. Our focus will be on <code>DateTimeFormat<\/code>, which is instrumental in adapting date and time presentation to different languages.<\/p>\n<hr>\n<h2>Capabilities of the <code>DateTimeFormat<\/code> Object<\/h2>\n<p>The <code>DateTimeFormat<\/code> constructor in JavaScript takes two optional arguments:<\/p>\n<ul>\n<li><code>locales<\/code> \u2013 This can be a string or an array of strings indicating language tags, such as \u201cde\u201d for German or \u201cen-GB\u201d for English as used in the United Kingdom. In the absence of a specific language tag, the default locale of the runtime environment is used.<\/li>\n<li><code>options<\/code> \u2013 An object whose properties allow customization of the date formatter. It includes properties such as:<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<td>Property<\/td>\n<td>Description<\/td>\n<td>Possible values<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>day<\/code><\/td>\n<td>Day of the month<\/td>\n<td>\u201c2-digit\u201d, \u201cnumeric\u201d<\/td>\n<\/tr>\n<tr>\n<td><code>era<\/code><\/td>\n<td>Era in which the date falls, e.g., AD or BC<\/td>\n<td>\u201cnarrow\u201d, \u201cshort\u201d, \u201clong\u201d<\/td>\n<\/tr>\n<tr>\n<td><code>formatMatcher<\/code><\/td>\n<td>Algorithm used for format matching<\/td>\n<td>\u201cbasic\u201d, \u201cbest fit\u201d [Default]<\/td>\n<\/tr>\n<tr>\n<td><code>hour<\/code><\/td>\n<td>Hour of the day<\/td>\n<td>\u201c2-digit\u201d, \u201cnumeric\u201d<\/td>\n<\/tr>\n<tr>\n<td><code>hour12<\/code><\/td>\n<td>Whether to use 12-hour format (true) or 24-hour format (false)<\/td>\n<td><code>true<\/code>, <code>false<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>localeMatcher<\/code><\/td>\n<td>Algorithm used for matching locales<\/td>\n<td>\u201clookup\u201d, \u201cbest fit\u201d [Default]<\/td>\n<\/tr>\n<tr>\n<td><code>minute<\/code><\/td>\n<td>Minute of the hour<\/td>\n<td>\u201c2-digit\u201d, \u201cnumeric\u201d<\/td>\n<\/tr>\n<tr>\n<td><code>month<\/code><\/td>\n<td>Month of the year<\/td>\n<td>\u201c2-digit\u201d, \u201cnumeric\u201d, \u201cnarrow\u201d, \u201cshort\u201d, \u201clong\u201d<\/td>\n<\/tr>\n<tr>\n<td><code>second<\/code><\/td>\n<td>Second of the minute<\/td>\n<td>\u201c2-digit\u201d, \u201cnumeric\u201d<\/td>\n<\/tr>\n<tr>\n<td><code>timeZone<\/code><\/td>\n<td>Time zone to use for formatting<\/td>\n<td>\u201cUTC\u201d, default to the runtime\u2019s time zone<\/td>\n<\/tr>\n<tr>\n<td><code>timeZoneName<\/code><\/td>\n<td>Name of the time zone<\/td>\n<td>\u201cshort\u201d, \u201clong\u201d<\/td>\n<\/tr>\n<tr>\n<td><code>weekday<\/code><\/td>\n<td>Day of the week<\/td>\n<td>\u201cnarrow\u201d, \u201cshort\u201d, \u201clong\u201d<\/td>\n<\/tr>\n<tr>\n<td><code>year<\/code><\/td>\n<td>Year<\/td>\n<td>\u201c2-digit\u201d, \u201cnumeric\u201d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Example:<\/p>\n<pre>\r\n var formatter = new Intl.DateTimeFormat('en-GB');\r\n \/\/ Returns a formatter for UK English date format\r\n<\/pre>\n<pre>\r\n var options = {weekday: 'short'};\r\n var formatter = new Intl.DateTimeFormat('en-GB', options);\r\n \/\/ Returns a formatter for UK English date format with weekday\r\n<\/pre>\n<hr>\n<h2>Utilizing the <code>format<\/code> Function<\/h2>\n<p>The <code>DateTimeFormat<\/code> object includes a property accessor named <code>format<\/code>. This function is designed to format a <code>Date<\/code> object according to the specified <code>locales<\/code> and <code>options<\/code> within the <code>DateTimeFormat<\/code> instance.<\/p>\n<p>It accepts either a <code>Date<\/code> object or <code>undefined<\/code> as an optional argument, returning a formatted date string.<\/p>\n<p><strong>Note:<\/strong> If no argument is provided, or if it\u2019s <code>undefined<\/code>, the function defaults to formatting the current date using <code>Date.now()<\/code>.<\/p>\n<p>Here\u2019s how it works:<\/p>\n<pre>\r\n new Intl.DateTimeFormat().format()\r\n \/\/ Returns the current date in the format specific to the runtime's locale\r\n<\/pre>\n<p>Let\u2019s explore some simple date formatting examples:<\/p>\n<p><iframe height=\"257\" scrolling=\"no\" src=\"https:\/\/codepen.io\/\/rpsthecoder\/embed\/ZGbLdL\/?height=257&theme-id=12825\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\" style=\"width: 100%;\">See the Pen <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\/rpsthecoder\/pen\/ZGbLdL\/\">ZGbLdL<\/a> by Preethi (<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\/rpsthecoder\">@rpsthecoder<\/a>) on <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\">CodePen<\/a>.<\/iframe><\/p>\n<p>Now, let\u2019s see how changing the language affects the output:<\/p>\n<p><iframe height=\"257\" scrolling=\"no\" src=\"https:\/\/codepen.io\/\/rpsthecoder\/embed\/gpambJ\/?height=257&theme-id=12825\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\" style=\"width: 100%;\">See the Pen <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\/rpsthecoder\/pen\/gpambJ\/\">gpambJ<\/a> by Preethi (<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\/rpsthecoder\">@rpsthecoder<\/a>) on <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\">CodePen<\/a>.<\/iframe><\/p>\n<p>Next, let\u2019s delve into the versatility of the formatting options:<\/p>\n<p><iframe height=\"257\" scrolling=\"no\" src=\"https:\/\/codepen.io\/\/rpsthecoder\/embed\/QbjpvK\/?height=257&theme-id=12825\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\" style=\"width: 100%;\">See the Pen <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\/rpsthecoder\/pen\/QbjpvK\/\">QbjpvK<\/a> by Preethi (<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\/rpsthecoder\">@rpsthecoder<\/a>) on <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codepen.io\/\">CodePen<\/a>.<\/iframe><\/p>\n<hr>\n<h2>Using the <code>toLocaleDateString<\/code> Method<\/h2>\n<p>As an alternative to the formatter approach, you can use <code>Date.prototype.toLocaleDateString<\/code> for similar functionality. This method also utilizes the <code>locales<\/code> and <code>options<\/code> arguments. While it\u2019s similar to using the <code>DateTimeFormat<\/code> object, the latter is recommended for applications handling a large number of dates.<\/p>\n<pre>\r\n var mydate = new Date('2015\/04\/22');\r\n var options = {\r\n   weekday: \"short\", \r\n   year: \"numeric\", \r\n   month: \"long\", \r\n   day: \"numeric\"\r\n };\r\n\r\n console.log(mydate.toLocaleDateString('en-GB', options));\r\n \/\/ Outputs \"Wed, 22 April 2015\"\r\n<\/pre>\n<hr>\n<h2>Checking Supported <code>locales<\/code><\/h2>\n<p>To determine which <code>locales<\/code> are supported, the <code>DateTimeFormat<\/code> object\u2019s <code>supportedLocalesOf<\/code> method can be used. This method returns an array of all supported locales or an empty array if none are supported. For example, to test, we can include a fictitious locale \u201cblah\u201d among the locales being checked.<\/p>\n<pre>\r\n console.log(Intl.DateTimeFormat.supportedLocalesOf([\"zh\", \"blah\", \"fa-pes\"]));\r\n \/\/ Outputs Array [ \"zh\", \"fa-pes\" ]\r\n<\/pre>\n<hr>\n<h2>References<\/h2>\n<ul>\n<li><abbr title=\"European association for standardizing information and communication systems\">ECMA<\/abbr> International: <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.ecma-international.org\/ecma-402\/1.0\/\">ECMAScript Internationalization API Specification<\/a><\/li>\n<li><abbr title=\"Internet Assigned Numbers Authority\">IANA<\/abbr>: <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.iana.org\/assignments\/language-subtag-registry\/language-subtag-registry\">Language Subtag Registry<\/a><\/li>\n<li>Norbert\u2019s Corner: <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/norbertlindenberg.com\/2012\/12\/ecmascript-internationalization-api\/index.html#DateTimeFormat\">Understanding the ECMAScript Internationalization API<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these preferences is key to user engagement and international success. This guide dives into the effective use of JavaScript\u2019s Internationalization API, as defined by ECMA, for customizing date displays in various languages and cultural norms.&hellip;<\/p>\n","protected":false},"author":145,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[4117],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>A Comprehensive Guide on Date Formatting for Global Websites - Hongkiat<\/title>\n<meta name=\"description\" content=\"Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A Comprehensive Guide on Date Formatting for Global Websites\" \/>\n<meta property=\"og:description\" content=\"Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-02T10:00:36+00:00\" \/>\n<meta name=\"author\" content=\"Preethi Ranjit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Preethi Ranjit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/\"},\"author\":{\"name\":\"Preethi Ranjit\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\"},\"headline\":\"A Comprehensive Guide on Date Formatting for Global Websites\",\"datePublished\":\"2024-02-02T10:00:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/\"},\"wordCount\":665,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"keywords\":[\"Javascripts\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/\",\"name\":\"A Comprehensive Guide on Date Formatting for Global Websites - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"datePublished\":\"2024-02-02T10:00:36+00:00\",\"description\":\"Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/date-internationalization-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A Comprehensive Guide on Date Formatting for Global Websites\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\",\"name\":\"Preethi Ranjit\",\"description\":\"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/preethi\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"A Comprehensive Guide on Date Formatting for Global Websites - Hongkiat","description":"Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these","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:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/","og_locale":"en_US","og_type":"article","og_title":"A Comprehensive Guide on Date Formatting for Global Websites","og_description":"Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these","og_url":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2024-02-02T10:00:36+00:00","author":"Preethi Ranjit","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Preethi Ranjit","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/"},"author":{"name":"Preethi Ranjit","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3"},"headline":"A Comprehensive Guide on Date Formatting for Global Websites","datePublished":"2024-02-02T10:00:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/"},"wordCount":665,"commentCount":5,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"keywords":["Javascripts"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/","url":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/","name":"A Comprehensive Guide on Date Formatting for Global Websites - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"datePublished":"2024-02-02T10:00:36+00:00","description":"Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/date-internationalization-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"A Comprehensive Guide on Date Formatting for Global Websites"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3","name":"Preethi Ranjit","description":"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.","url":"https:\/\/www.hongkiat.com\/blog\/author\/preethi\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-6dE","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/23910","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/145"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=23910"}],"version-history":[{"count":4,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/23910\/revisions"}],"predecessor-version":[{"id":71175,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/23910\/revisions\/71175"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=23910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=23910"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=23910"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=23910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}