Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
Hi,
U should use set.
Set ReportingMonth = date(date#(MonthStart(Today(),-1)),'MM/YYYY')
And then use as $(ReportingMonth)
Thanks,
Vikram.
use this
=Date(Date#('01.01.2015', 'DD.MM.YYYY'),'DD/MM/YYYY')
Hi,
Find the following Date# Function i think it will help you.
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 |
Hi
Apart from above you can also use
=Date(Replace('01.01.2015','.','/'),'MM/YYYY')
Thanks,
Vikram
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');
have you check your date format like
SET DateFormat='M/D/YYYY';
In the edit script some few set statements are there.
I think you can achieve it with many ways. Mehl has provided you a way
Date(replace(DateField,'.','/'),'MM/DD/YYYY')
Hi Mehl, Your Expression is Wrong use this.
LET ReportingMonth = date(date#(MonthStart(Today(),-1)),'MM/YYYY')
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');
Unfortuneately the expressions doesn't work. It has the same result as mine: 0.001488....