Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Special Characters in Formatting

Hi,

I need to add a "/" within my date format (script). Date('01.01.2015', 'MM/YYYY'), but I don't get the expected result. Instead the month is divided by the year.

Can someone help?

Tanks in advance!

1 Solution

Accepted Solutions
vikramv
Creator III
Creator III

Hi,

U should use set.

Set ReportingMonth = date(date#(MonthStart(Today(),-1)),'MM/YYYY')

And then use as $(ReportingMonth)

Thanks,

Vikram.

View solution in original post

15 Replies
prma7799
Master III
Master III

use this

=Date(Date#('01.01.2015', 'DD.MM.YYYY'),'DD/MM/YYYY')

Anonymous
Not applicable
Author

Hi,

Find the following Date# Function i think it will help you.

Date#

date#(expression [ , format-code ])

The date# function evaluates the expression as a date according to the string given as format-code. If the format code is omitted, the default date format set in the operating system is used.

Examples:

The examples below assume the two following operating system settings:

    

Default setting 1 Default setting 2
Date format   YY-MM-DD   M/D/YY
vikramv
Creator III
Creator III

Hi

Apart from above you can also use

=Date(Replace('01.01.2015','.','/'),'MM/YYYY')

Thanks,

Vikram

Not applicable
Author

thank you, but it still doesn't work. Maybe the context helps:

We have it as a variable:

LET ReportingMonth = date(date#(MonthStart(Today(),-1),'YYYY-MM-DD'),'MM/YYYY');

prma7799
Master III
Master III

have you check your date format like

SET DateFormat='M/D/YYYY';

In the edit script some few set statements are there.

sujeetsingh
Master III
Master III

I think you can achieve it with many ways. Mehl has provided you a way

Date(replace(DateField,'.','/'),'MM/DD/YYYY')

vikramv
Creator III
Creator III

Hi Mehl, Your Expression is Wrong use this.

LET ReportingMonth = date(date#(MonthStart(Today(),-1)),'MM/YYYY')

Not applicable
Author

We have the following DateFormat:

SET DateFormat='YYYY-MM-DD';

Therefore we used:

LET ReportingMonth = date(date#(MonthStart(Today(),-1),'YYYY-MM-DD'),'MM/YYYY');

Not applicable
Author

Unfortuneately the expressions doesn't work. It has the same result as mine: 0.001488....