WebMasterCampus
WEB DEVELOPER Resources

Javascript How to Get Date in Different Laguages

Learn How to Get Date in Different Laguages using Javascript


Javascript Get Date in Different Laguages

To get the date in different languages using Javascript is easy. We just need to use toLocaleDateString() function with the ’locales’ and ‘options’.

The toLocaleDateString() method returns a string with a language sensitive representation of the date portion of this date. The new locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function.

toLocaleDateString() Syntax

    dateObj.toLocaleDateString([locales [, options]])

Example 1

var today  = new Date();
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };

console.log(today.toLocaleDateString("en-US")); // 2/28/2020
console.log(today.toLocaleDateString("en-US", options)); // Friday, Feburary 28, 2020
console.log(today.toLocaleDateString("hi-IN", options)); // सोमवार, 23 मार्च 2020

Example 2


const date1 = new Date(1996, 11, 17);
// const date1 = new Date('2011-10-14T03:24:00');
// const date1 = new Date(1996, 11, 17);
// const date1 = new Date(1999, 11, 20, 3, 24, 0);

const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };

console.log(date1.toLocaleDateString(undefined, options));
console.log(date1.toLocaleDateString('en-US', options));
console.log(date1.toLocaleDateString('en-GB', options));
console.log(date1.toLocaleDateString('ko-KR', options));
console.log(date1.toLocaleDateString('ar-EG', options));
console.log(date1.toLocaleDateString('de-DE', options));
console.log(date1.toLocaleDateString('hi-IN', options));
console.log(date1.toLocaleDateString('ja-JP', options));

Learn more about toLocaleDateString()

Learn more about DateTimeFormat()

Learn more about Date

Common Locales

  • ar-SA: For Arabic (Saudi Arabia)
  • bn-BD: For Bangla (Bangladesh)
  • bn-IN: For Bangla (India)
  • cs-CZ: For Czech (Czech Republic)
  • da-DK: For Danish (Denmark)
  • de-AT: For Austrian German
  • de-CH: For “Swiss” German
  • de-DE: For Standard German (as spoken in Germany)
  • el-GR: For Modern Greek
  • en-AU: For Australian English
  • en-CA: For Canadian English
  • en-GB: For British English
  • en-IE: For Irish English
  • en-IN: For Indian English
  • en-NZ: For New Zealand English
  • en-US: For US English
  • en-ZA: For English (South Africa)
  • es-AR: For Argentine Spanish
  • es-CL: For Chilean Spanish
  • es-CO: For Colombian Spanish
  • es-ES: For Castilian Spanish (as spoken in Central-Northern Spain)
  • es-MX: For Mexican Spanish
  • es-US: For American Spanish
  • fi-FI: For Finnish (Finland)
  • fr-BE: For Belgian French
  • fr-CA: For Canadian French
  • fr-CH: For “Swiss” French
  • fr-FR: For Standard French (especially in France)
  • he-IL: For Hebrew (Israel)
  • hi-IN: For Hindi (India)
  • hu-HU: For Hungarian (Hungary)
  • id-ID: For Indonesian (Indonesia)
  • it-CH: For “Swiss” Italian
  • it-IT: For Standard Italian (as spoken in Italy)
  • jp-JP: For Japanese (Japan)
  • ko-KR: For Korean (Republic of Korea)
  • nl-BE: For Belgian Dutch
  • nl-NL: For Standard Dutch (as spoken in The Netherlands)
  • no-NO: For Norwegian (Norway)
  • pl-PL: For Polish (Poland)
  • pt-BR: For Brazilian Portuguese
  • pt-PT: For European Portuguese (as written and spoken in Portugal)
  • ro-RO: For Romanian (Romania)
  • ru-RU: For Russian (Russian Federation)
  • sk-SK: For Slovak (Slovakia)
  • sv-SE: For Swedish (Sweden)
  • ta-IN: For Indian Tamil
  • ta-LK: For Sri Lankan Tamil
  • th-TH: For Thai (Thailand)
  • tr-TR: For Turkish (Turkey)
  • zh-CN: For Mainland China, simplified characters
  • zh-HK: For Hong Kong, traditional characters
  • zh-TW: For Taiwan, traditional characters
Created with love and passion.