Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qw_jakub
Partner - Contributor III
Partner - Contributor III

Week-Year in Date format

Hello,

is there a way to format a date field as WeekNumber-Year (1-2013,2-2013, ..., 53-2013) similar to: 

date(monthstart(TempDate), 'MMM-YYYY') as [Month-Year]

?

I can do it as

Week(TempDate) & '-' & Year(TempDate)

but this will not be understood as a date represantaion a will not sort accordingly.

Thanks for any suggestions!

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try weekname() function.

View solution in original post

4 Replies
tresesco
MVP
MVP

Try weekname() function.

qw_jakub
Partner - Contributor III
Partner - Contributor III
Author

Thanks,

this is simple and good sollution. Is there a way to reformat it from '2013/52' to: '52-2013' ?

jvishnuram
Partner - Creator III
Partner - Creator III

Hi Jakub,

Try this,

DATE:

Load Max(Date) as MAX_DATE,

Min(Date) as MIN_DATE

from Table_Name;

Let vMinDate = Peek('MIN_DATE',0,'DATE');


in the calendar use this.,

Num(Week($(vMinDate) + IterNo() - 1), '00')&'-'&Num(Year($(vMinDate) + IterNo() - 1)) as EXPEXTED

tresesco
MVP
MVP

I guess there is no system date format for the same. You can consider (in the front end) changing the representation using string functions.