Qlik Community

Ask a Question

New to QlikView

If you’re new to QlikView, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator
Creator

different date formats

Hi all,

Can we have a same column with different date formats in a single table?

Ps.this question was asked in interview

Regards

Manu

11 Replies
Master
Master

You can change the format and then create a different format column

load

date, date(date,'DD/MM/YYYY') AS Date1

and so on..

Creator III
Creator III

A date is internally just a number so you can format whichever way you like?

Each time you format it will be applied to all rows.

You can add specific formats based on conditions.

If instead you have a date column in different formats you need to load you will have to

use DATE#(field,format) which expects the date in the defined format.  I believe if the

field is not in the prescribed format, it will return null (not sure - a simple test can be done).

Often DATE and DATE# are used to standardize date fields or convert them from one

format to another.

Creator
Creator

Hi SHIVESH,

But i want different row formats for different rows for single column

Creator
Creator

loveisfailstalwar1‌pls help

Creator III
Creator III

Hi Sharma,

I think you try Alt function it take different format of date like below and convert to one format

load Date(Alt(Date#(Date,'DD/MM/YYYY'),Date#(Date,'DD-MM-YYYY'),Date#(Date,'DD.MM.YYYY'),Date#(Date,'YYYY.MM.DD')),'DD-MM-YYYY') as Date2;

LOAD * INLINE [

    Date

    12/03/2018

    23-05-2018

    26.12.2017

    2018.02.13

];



Regards

Ahmar

Until unless, If you won't sufficient question i believe you won't get any output. Will you provide some input data and explain result data as always.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

Short answer: yes, "dates" for QlikView are values just by other name, i.e.: QlikView does not have data types.

As Ahmar points above, it all comes to how you transform that data during the LOAD process which happens in the script. Alt() is one option, I would suggest If() as well.

If the question is not about the datamodel but in a straight or pivot chart, it is also possible using likewise Alt() or If(), not recommended for large sets of data but it will work.

If the question is about a Table box object then the answer is also yes, you can display whatever value you load from the source but you will not be able to format them the same evenly, each will display with the format they come from the data source.

You can configure the date format strings so the date format is based on the user's preferences e.g DD/MM/YYYY for UK users, MM/DD/YYYY for US users and DD.MM.YYYY for european users, and then apply that setting in the chart.

So the same table will format the date differently depending on which use is connected to the application.

Partner
Partner

Hi Colin,

How is this achieved??  I have US and UK clients and the date formats are a sticking point for sure.


Rayna