Bixby Developer Center


21H Capsule SDK Release Notes

Updated: September 7, 2021

New Locale Formatting Function for DateTime JavaScript API

You can now specify a locale while formatting a DateTime concept with the format JavaScript function. You must specify the locale in language-country format, such as en-US or ko-KR.

var dates = require('dates')
module.exports.function = function ShowDateTimeFormat (locale) {
const DATE_FORMAT = {
"ko-KR": "yyyy년 M월 d일", //"2021년 7월 14일",
"en-US": "MMMM d, yyyy", // July 14, 2021
const dateFormat = DATE_FORMAT[locale] ? DATE_FORMAT[locale] : DATE_FORMAT['en-US']
const now =
const current_dateTime = dates.ZonedDateTime.of(now.getTimeZoneId(), 2021, 7, 14, 23, 59, 59)
const dateTimeString = current_dateTime.format(dateFormat, locale)
return dateTimeString

Here is an example of what displays if you pass a different locale for the same pattern. For example, with the pattern MMMM dd, yyyy:

  • en-US, the formatted date will be July 07, 2021
  • de-DE, the formatted date will be Juli 07, 2021