Tuesday, May 18, 2010

DateConverter tip - get weeknumber in one line

If you want to get the week number from a date:
DateConverter.dateToString( date, 'w' )
The DateConverter script

2 comments:

Rasmus said...

Nice tip, but I do have a follow up question: Which standard does it follow?

As an example, the week of January 1, 2010 is labelled as week 1 of 2010 in the US, while that same week is regarded as week 53 of 2009 in Norway.

Tommy Valand said...

The default locale is the locale of the server (maybe the application if it's localized).