Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
yanivbm88
Contributor

Formula for date format identification

Hi All,

Is there a formula that can get a date and return it's format?

Example:

Input: 31122015 Output: DDMMYYYY

Tags (2)
1 Solution

Accepted Solutions

Re: Formula for date format identification

Here is what I suggest

If(Num(Date#(DateField, 'DDMMYYYY')) > 0, 'DDMMYYYY',

     If(Num(Date#(DateField, 'YYYYMM')) > 0, 'YYYYMM',

          If(Num(Date#(DateField, 'YYYYMMDD')) > 0, 'YYYYMMDD',

               ..... and so on...

6 Replies

Re: Formula for date format identification

You might be able to create one... but the issue will be for an input like this 01022015... is this DDMMYYYY or MMDDYYYY?

Partner
Partner

Re: Formula for date format identification

Hi Yaniv,

Please Use Below Code:

=Date(Date#('31122015','DDMMYYYY'),'DD-MM-YYYY')

Thanks,

Arvind Patil

Partner
Partner

Re: Formula for date format identification

=Date(Date#('31122015','DDMMYYYY'),'Write Your Date Format Here')


Thanks,

Arvind Patil

Re: Formula for date format identification

Arvind OP is looking to get the format as an output

When the user enters 31122015, they need to see DDMMYYYY

yanivbm88
Contributor

Re: Formula for date format identification

Anything you know that already exists?

Regarding the issue you raised, I guess that is something that will have to be defined as a fixed property. When Day and month can be both, choose X. (Maybe according to country standard format)

Re: Formula for date format identification

Here is what I suggest

If(Num(Date#(DateField, 'DDMMYYYY')) > 0, 'DDMMYYYY',

     If(Num(Date#(DateField, 'YYYYMM')) > 0, 'YYYYMM',

          If(Num(Date#(DateField, 'YYYYMMDD')) > 0, 'YYYYMMDD',

               ..... and so on...