Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Format date

Bonjour,

est il possible de formater la date du type may of 16th, 2015? ma question est surtout sur le th du jour.... je n'ai rien vu dans les blogs.

De plus, est il possible de forcer le langage des mois. Je voudrais garder mon PC en Francais mais avoir le language de QlikView (dans les textes des objets texte par exemple et non que l'interface de l'appli.

Merci

Sébastien

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

Utilisé Applymap() pour le jour  et la Dual() function:

Day:

Mapping load * inline [From, To

1,1st

2,2nd

3,3rd

4,4th

5,5th

...

...

];

Load Dual(Month(Date#(Date,'DD-MM-YYYY'))&' of '&ApplyMap('Day',Day(Date#(Date,'DD-MM-YYYY')))&', '&Year(Date#(Date,'DD-MM-YYYY')),Date#(Date,'DD-MM-YYYY')) as MyDate;

Load * Inline [Date

'1-4-2015'

'2-4-2015'

'3-4-2015'

];

View solution in original post

8 Replies
MK_QSL
MVP
MVP

Consider you have below dates..

1st, Jan 2014

12th, Feb 2015

22nd, Mar 2013

23rd, Apr 2015

You can convert them by below formula.. either in script or in UI

Date(MakeDate(SubField(OldDate,' ',-1),NUM(Month(Date#(Trim(TextBetween(OldDate,' ',' ')),'MMM'))),KeepChar(SubField(OldDate,',',1),'0123456789')))

awhitfield
Partner - Champion
Partner - Champion

Salut Sébastien ,  voir le blog ci-joint:

https://community.qlik.com/blogs/qlikviewdesignblog/2014/12/02/the-date-function

vous pouvez utiliser

Date(YourDate,'MMM DD,YYYY') AS FormattedDate

SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='£#,##0.00;-£#,##0.00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

les valeurs par défaut sont dans le script , changez-les ici
Andy

Anonymous
Not applicable
Author

merci mais je n'ai pas le th après le jour...

awhitfield
Partner - Champion
Partner - Champion

Je ne pense pas que vous pouvez le faire !

stigchel
Partner - Master
Partner - Master

Utilisé Applymap() pour le jour  et la Dual() function:

Day:

Mapping load * inline [From, To

1,1st

2,2nd

3,3rd

4,4th

5,5th

...

...

];

Load Dual(Month(Date#(Date,'DD-MM-YYYY'))&' of '&ApplyMap('Day',Day(Date#(Date,'DD-MM-YYYY')))&', '&Year(Date#(Date,'DD-MM-YYYY')),Date#(Date,'DD-MM-YYYY')) as MyDate;

Load * Inline [Date

'1-4-2015'

'2-4-2015'

'3-4-2015'

];

stigchel
Partner - Master
Partner - Master

I would rather complete the mapping then complicating the load expression. In your expression you still need to add Day(Date(Date,'DD_MM_YYYY'))=1 or.....

Instead of Date=1, which is never true

And then there is e.g. 22nd

robert_mika
Master III
Master III

You are right Piet.

My mistake

I have just taken off my posts to not confused anyone

ankitaag
Partner - Creator III
Partner - Creator III

Salut ,

Oui, vous pouvez à l'aide de diverses fonctions , le seul problème est avec mois . Vous devez convertir explicitement cette chaîne de mois en format lisible (nombre ) soit dans le script ou au frontend .

Le moyen par lequel vous pouvez formater les dates est :

=Date(Date#(MakeDate(Right('May 16th,2015',4) ,

  If(Left('May 16th,2015',3)='Jan',1,If(Left('May 16th,2015',3)='Feb',2,If(Left('May 16th,2015',3)='Mar',3,If(Left('May 16th,2015',3)='Apr',4,

  If(Left('May 16th,2015',3)='May',5,If(Left('May 16th,2015',3)='Jun',6,If(Left('May 16th,2015',3)='Jul',7,

  If(Left('May 16th,2015',3)='Aug',8,If(Left('May 16th,2015',3)='Sep',9,If(Left('May 16th,2015',3)='Oct',10,

  If(Left('May 16th,2015',3)='Nov',11,If(Left('May 16th,2015',3)='Dec',12)))))))))))) ,

mid('May 16th,2015',5,2)),'DD-MM-YYYY'),'MM/DD/YYYY')