locale

How do I convert date to the string in go using locale?

眉间皱痕 提交于 2021-01-22 13:21:31
问题 I convert date to a string this way: d.Format("Mon 02. Jan") and I get something like Fri 27. Jan How can I switch the locale and get the string in other language? 回答1: You can't. The Go standard library does not contain localized month, day and zone names. The names are wired into the time package. For example, the name of the months returned by Month.String() are stored in the unexported time.month global variable: var months = [...]string{ "January", "February", "March", "April", "May",

Angular Material DatePicker's input shifts month and day after typing

点点圈 提交于 2021-01-21 06:08:21
问题 I'm developing a app using Ionic 4/Angular 7 and Angular Material 7.2.1. The app uses brazilian date format DD/MM/YYYY. When I select the date with the datepicker itself the text in the input is fine. But, after type the date in the datepicker's (on blur) input, the month and day are switched. For example, if I type 03/02/2015, after a blur event, the input will show 02/03/2015. app.module.ts: import 'moment/locale/pt-br'; import { MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material';

Angular Material DatePicker's input shifts month and day after typing

老子叫甜甜 提交于 2021-01-21 06:05:49
问题 I'm developing a app using Ionic 4/Angular 7 and Angular Material 7.2.1. The app uses brazilian date format DD/MM/YYYY. When I select the date with the datepicker itself the text in the input is fine. But, after type the date in the datepicker's (on blur) input, the month and day are switched. For example, if I type 03/02/2015, after a blur event, the input will show 02/03/2015. app.module.ts: import 'moment/locale/pt-br'; import { MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material';

Get locale specific date/time format in Java

倾然丶 夕夏残阳落幕 提交于 2021-01-02 08:17:42
问题 I have use case in java where we want get the locale specific date. I am using DateFormat.getDateInstance final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.forLanguageTag(locale))); This translates the dates but ja-JP this translates the date "17 January 2019" to "2019/01/17" but I need something like "2019年1月17日". For all other locales this correctly translates the date. Please let know if there is other method to get this. 回答1: This worked for me: public

Get locale specific date/time format in Java

我怕爱的太早我们不能终老 提交于 2021-01-02 08:15:38
问题 I have use case in java where we want get the locale specific date. I am using DateFormat.getDateInstance final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.forLanguageTag(locale))); This translates the dates but ja-JP this translates the date "17 January 2019" to "2019/01/17" but I need something like "2019年1月17日". For all other locales this correctly translates the date. Please let know if there is other method to get this. 回答1: This worked for me: public

Get locale specific date/time format in Java

混江龙づ霸主 提交于 2021-01-02 08:15:15
问题 I have use case in java where we want get the locale specific date. I am using DateFormat.getDateInstance final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.forLanguageTag(locale))); This translates the dates but ja-JP this translates the date "17 January 2019" to "2019/01/17" but I need something like "2019年1月17日". For all other locales this correctly translates the date. Please let know if there is other method to get this. 回答1: This worked for me: public

Django 1.9 sr_Latn locale doesn't work

给你一囗甜甜゛ 提交于 2020-12-30 02:57:12
问题 In Django 1.6.5 the following worked: in settings.py LANGUAGES = ( ('sr_Latn', 'Srpski'), ('en', 'English'), ) whereas the locale folder with translation was also called sr_Latn . With Django 1.9.2. sr_Latn is not recognized as a language code any more so I have to enter sr-latn, but then the locale folder is not found - regardless if it is called sr-latn, sr-Latn, sr_latn or sr_Latn. LANGUAGES = ( ('sr-latn', 'Srpski'), ('en', 'English'), ) This problem is specific to Serbian-Latin only

How to use unsupported Locale in Java

江枫思渺然 提交于 2020-12-19 04:16:33
问题 As part of Internationalisation, got a requirement to support few countries like Antigua and Barbuda - ISO3166 code - AG & Dominican Republic - ISO3166 code - DO Locale loc = new Locale("en", "AG"); DateFormat df1 = DateFormat.getDateInstance(DateFormat.SHORT, loc); System.out.println("Short format: " + df1.format(new Date())); Java will display date in format mm/dd/yy, where as date format in those countries are dd/mm/yy. Is there any way we can achieve the pattern dd/mm/yy? Even ICU4J

Unable to Parse a date of format d MMMM yyyy in Polish Locale in Java

半城伤御伤魂 提交于 2020-12-07 06:38:16
问题 I tried to parse the date (3 December, 2020) with format d MMMM yyyy in Polish Locale but it is unable to parse. But why the same parsing is working fine in any other locale like english, etc. Below is the code sample which is not working. Can anyone please help on this ? Locale loc = new Locale("pl", "PL"); String date = "3 December 2020"; SimpleDateFormat sdFormat = new SimpleDateFormat("d MMMM yyyy", loc); sdFormat.setLenient(false); try { Date d = sdFormat.parse(date); System.out.println

Unable to Parse a date of format d MMMM yyyy in Polish Locale in Java

蹲街弑〆低调 提交于 2020-12-07 06:37:41
问题 I tried to parse the date (3 December, 2020) with format d MMMM yyyy in Polish Locale but it is unable to parse. But why the same parsing is working fine in any other locale like english, etc. Below is the code sample which is not working. Can anyone please help on this ? Locale loc = new Locale("pl", "PL"); String date = "3 December 2020"; SimpleDateFormat sdFormat = new SimpleDateFormat("d MMMM yyyy", loc); sdFormat.setLenient(false); try { Date d = sdFormat.parse(date); System.out.println