Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get date properly

Hi Everyone!

I am getting data onto Qlikview from excel. In it is a column for date, but its formatted in a way that both date and time are present in the cell, for example:

2014-01-19 23:59:33.0

Now, from it I only need date, not the time. I tried using the date function, but when i use it as a list box, the same date turns up multiple times( as many times as its entries in the excel)

I need the date as unique values in a list, which function can i use?

Thanks in advance for all the queries.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

LOAD Date(Floor([Request Time])) as Date

FROM

.....\sample data for date.xlsx]

(ooxml, embedded labels, table is Sheet1);

View solution in original post

24 Replies
Not applicable
Author

try this

date(date#(datefield,'YYYY-MM-DD hh:mm:ss'),'DD-MM-YYYYY')

datanibbler
Champion
Champion

Hi,

so you want only the date in QlikView, but in your base_data you have multiple entries per date?

That cannot be done easily - well, you could cut off the time_part using a STRING function, but that would cause you to lose data, wouldn't it?

=> If you don't need multiple records per day, but only one, try using FIRST() or SUBSTRING().

Not applicable
Author

Trying now. Will keep you posted.

Not applicable
Author

Hi Datanibbler,

There is only loss of the time part of the data, there are not multiple dates in each cell, just a date and a time.

Not applicable
Author

Hi,

You can use these;

subfield(F1,' ',1) as date1,
or
date#(left(F1,10),'YYYY-MM-DD') as date

HTH

-Shruti

sushil353
Master II
Master II

Hi..

first of all set the environment variable to the desired format of date

SET DateFormat='MM/DD/YYYY';

after that you can try this expression

date(date#(datefield,'YYYY-MM-DD hh:mm:ss'),'MM/DD/YYYY')

HTH

Sushil

MK_QSL
MVP
MVP

Add Below Lines to your script, it will completely remove the time field....

Date(Floor(YourDateField,'YYYY-MM-DD')

jagannalla
Partner - Specialist III
Partner - Specialist III

Hi,

Try this,

Date(Floor(DateField),'MM/DD/YYY'Y)

Hope it helps you!!!

Thanks,

Jagan

Not applicable
Author

Hi Sushil,

This returned a list box which was empty