Custom Date/Time Formats per language

I'm wondering, is there a way from a custom Dijit widget to get the configured date/time format for the current user's language? Or is the only way to get this kind of thing from the locale set in the browser? I have an instance where a custom widget is displaying a different time format than a date picker, because the custom time format in the Modeler for the language is set to US time (ie 11:00 pm), but I am in Europe, so my browser locale is set to display time as 23:00, which is how it displays in the widget. Is there a way in the widget to see what custom time format is set for the current language, and then to use that to display in the same way within the widget?
1 answers

Hi David

"configured date/time format for the current user's language"

User time zone is not directly connected to the language

Time zone information of the browser is used to determine date time value of object .get .set function will automatically adjust when the date and time attribute attribute in your model has enabled the "localized yes"

Some usefull information could also be found in the session

mx.session.sessionData.locale = {firstDayOfWeek: 0, code: "en_US"}

With the domain model the and user ID you could find the configured time zone etc. (though this relation is only used in some exceptional cases where the browser does not provide timezone session information to the server

Date formatting strings could be done via

Found 2 snippets in the Mendix client for epoch calculations

function localizeEpoch(e) {
	var t = new Date(Number(e));
	return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()).getTime()

function delocalizeEpoch(e) {
	var t = new Date(Number(e));
	return Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds())


Custom widget can have translatable string. Which could be configured per language. This way, each form can be set per language a date formatting. using the format Value functions.

I hope the information get you to your answer.