# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
New Contributor II

## How to enter current week as two digits in a string

Hello,

I have a script where I need to enter the current year and week as fields. The problem is that I need to enter the current week as two digits (08, 09, 10, 11 etc), but now it enters the week as 8, 9, 10, 11 so the end result for this week is 20181 and not 201801.

Is there any way to set the week standard value as XX and not X?

My script now:

vWeek=Year(now())&week((now()))

AUTOSTOCK:

LOAD

DEAL AS [DEALER],

PRIS AS PRICE,

\$(vWeek) AS Week;

SQL SELECT *

FROM ......

Thank you

Tags (2)
6 Replies
MVP

## Re: How to enter current week as two digits in a string

Try like:

vWeek=Year(now())& Num( week((now())), '00')

Valued Contributor III

## Re: How to enter current week as two digits in a string

Hi,

vWeek=Year(now())&Num(week((now())),'00')

or

vWeek=Year(now())&Num(week(now()),'00')

New Contributor II

## Re: How to enter current week as two digits in a string

Thank you for the quick response. It worked like a charm!

Do you also know if it is possible to write it as last week so it shows 201752? That is current week minus 1 week.

MVP

## Re: How to enter current week as two digits in a string

This?

vWeek=Year(now())& Num( week((Today()-7)), '00')

MVP

## Re: How to enter current week as two digits in a string

A better solution could be: =Purgechar(Weekname(today(),-1),'/')

New Contributor II

## Re: How to enter current week as two digits in a string

Beautiful! Works like a charm.

Thank you very much!