Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
brunobertels
Master
Master

Problème format de date et calendrier

Bonjour

Je rencontre un problème de format de Date et de création de calendrier.

En effet dans ma table (fichier excel) j'ai un champs "Date" qui se présente sous ce format :

23 févr. 2015 16:02

et sous ce format dans google sheet :

05/03/2015 18:00:00



le problème provient des heures incluses dans ce format dont je n'ai pas besoin.

En effet si j'ai réussi à coté à créer un calendrier maitre qui me fait des regroupements par semaine, mois et trimestre , les données s'affichant distinguent toutes les heures existante pour une date donnée :

Je ne sais pas comment et ou déclarer un changement de format pour avoir un format de date au plus simple du type 02.01.2015 ou 02/01/2015.

J'ai cherché un peu partout mais pas trouver de solution et je voudrais éviter de devoir changer le format de date directement dans ma base.

Pouvez-vous m'aider ?

Merci d'avance

Bruno

1 Solution

Accepted Solutions
maxgro
MVP
MVP

// first of all some data (instead of excel; if you want post the excel)

Excel:

load * inline [

Date

23 févr. 2015 16:02

3 janv. 2015 11:04

];

// I need a mapping table to decode excel month (from field) to standard month number (to field)

// add the missing month (sorry but je ne me rappelle le francais de l'ecole)

MapMonth:

mapping load * inline [

from,to

janv,1

févr,2

june,6

aout,8

];

// the bold statement to get a date

table:

load

  Date,

  date(floor(date#(MapSubString('MapMonth', Date),'DD MM. YYYY hh:mm'))) as NewDate2

Resident

  Excel;

and this is the result

1.jpg

some detail

  date(floor(date#(MapSubString('MapMonth', Date),'DD MM. YYYY hh:mm'))) as NewDate2

starting from the inner function

- MapSubstring to change fevr --> 2, janv --> using MapMonth

- date# to interpret the string with the format DD MM. YYYY hh:mm (I have a number nnnn,mmmm)

- floor to get the date part (floor for date part nnn, frac for time part mmmm)

- date to format the date

some more detail?

QlikView Date fields

P.S.:if you can post the excel, someone in the community can try


View solution in original post

3 Replies
maxgro
MVP
MVP

// first of all some data (instead of excel; if you want post the excel)

Excel:

load * inline [

Date

23 févr. 2015 16:02

3 janv. 2015 11:04

];

// I need a mapping table to decode excel month (from field) to standard month number (to field)

// add the missing month (sorry but je ne me rappelle le francais de l'ecole)

MapMonth:

mapping load * inline [

from,to

janv,1

févr,2

june,6

aout,8

];

// the bold statement to get a date

table:

load

  Date,

  date(floor(date#(MapSubString('MapMonth', Date),'DD MM. YYYY hh:mm'))) as NewDate2

Resident

  Excel;

and this is the result

1.jpg

some detail

  date(floor(date#(MapSubString('MapMonth', Date),'DD MM. YYYY hh:mm'))) as NewDate2

starting from the inner function

- MapSubstring to change fevr --> 2, janv --> using MapMonth

- date# to interpret the string with the format DD MM. YYYY hh:mm (I have a number nnnn,mmmm)

- floor to get the date part (floor for date part nnn, frac for time part mmmm)

- date to format the date

some more detail?

QlikView Date fields

P.S.:if you can post the excel, someone in the community can try


brunobertels
Master
Master
Author

Bonjour Massimo

Je répond tardivement , je ne retrouvais plus mon post

J'ai finalement réussi à résoudre mon problème de format de date comme suit :

LOAD

    "Mois Rdv",

    "Semaine Rdv",

    "Type Appel",

    "Date prise Rdv",

    "Date",

   

    Date(Timestamp#("Date",'DD MMMM YYYY hh:mm'),'DD/MM/YYYY') as "Date du Rdv",

   

   

    Year(Timestamp#("Date",'DD MMMM YYYY hh:mm')) as Année,

     'Tri ' & Num(Ceil(Month(Timestamp#("Date",'DD MMMM YYYY hh:mm'))/3),'(ROM)0') as Trimestre,

     Month(Timestamp#("Date",'DD MMMM YYYY hh:mm')) as Mois,

     Week(Timestamp#("Date",'DD MMMM YYYY hh:mm')) as Semaine,

     day(Timestamp#("Date",'DD MMMM YYYY hh:mm')) as Jour,

     Weekday(Timestamp#("Date",'DD MMMM YYYY hh:mm')) as JourSemaine,

     hour(Timestamp#("Date",'DD MMMM YYYY hh:mm')) as Heure,

Merci pour ton aide qui m'a permis de trouver cette solution

Cordialement,

Bruno

st_rives
Contributor II
Contributor II

Many thanks for your solution Massimo. It has been very useful for me.

I just needed to do few change as not all months are reduced with an ending dot (French specific) :

// first of all some data (instead of excel; if you want post the excel)

Excel:

load * inline [

Date

16 sept. 2016 19:31:03
13 avr. 2017 12:01:25
30 janv. 2017 16:09:03
4 sept. 2015 18:40:34
4 mai 2017 14:04:35
10 mars 2017 17:16:30
18 janv. 2017 18:44:44
27 avr. 2017 11:50:37
11 avr. 2017 17:34:48
9 mai 2017 08:11:49
3 août 2017 12:25:58
23 août 2017 08:34:36
7 juil. 2017 20:18:24
20 juin 2017 00:23:35
20 mars 2017 11:26:57
6 févr. 2017 10:47:17
13 janv. 2017 15:26:54

];

// I need a mapping table to decode excel month (from field) to standard month number (to field)

// add the missing month (sorry but je ne me rappelle le francais de l'ecole)


MapMonth:

mapping load * inline [

from,to
janv., 1
févr., 2
mars, 3
avr., 4
mai, 5
juin, 6
juil., 7
août, 8
sept., 9
oct.,10
nov.,11
déc.,12
];


// the bold statement to get a date

table:

load

  Date,

  date(floor(date#(MapSubString('MapMonth', Date),'DD MM YYYY hh:mm:ss'))) as NewDate2

Resident

  Excel;