week number in smart client

Hi,

The weeknumber returned by ```
parseInt(utils.dateFormat(new Date(), ‘w’))

I wunder if it is possible ( in a method ) to get the dutch week number, even if the locale settings of the (smart) client is set to the wrong value (english for instance).

Regards,

You could set the locale using i18n.setLocale() function.

Hi Hans,

this difference is caused by ‘firstDayOfWeek’.
Dutch is using monday where US is using sunday…

As Rick mentioned, you could set the local just temporary to the one you want.
Another option is using the dateutils plugin of servoy-plugins.de (free plugin)
There you can set what the first day of week is and use the ‘dateFormat’ function of the plugin.

Hope this helps

And if you don’t want to (or can’t) install a plugin you can always take a look at the excellent mod_datejs module (based on Date.js) from Greg Pierce.

Hope this helps.

Thanks guys,

This seems to work without any plugin or module

//get current locale settings	
var coun = i18n.getCurrentCountry();
var lang = i18n.getCurrentLanguage();
//set locale to nl
i18n.setLocale('nl','NL');
//get weekno
weekno = parseInt(utils.dateFormat(new Date(), 'w'));
//set locale back to previous value
i18n.setLocale(lang,coun);