Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date

Hi

I have in the DB "Datetime" this is "dd.MM.YYYY mm.hh". Like this "12.08.2013 10:45". How can I load just the date "12.08.2013"?

1 Solution

Accepted Solutions
tresesco
MVP
MVP


This?

LoadedTable:

Load *,

          Date(Floor(Date#(DATETIME, 'DD.MM.YYYY mm.hh.fff'))) As Date ;

       

ODBC CONNECT TO [xxx](xxx,xxx)

SQL SELECT Id,

                    action,

                    DATETIME

                

FROM XX."XX";

And if this too not working, try simply:

Date(Floor(DATETIME)) As Date

View solution in original post

14 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should do it:

Date(Floor(Date#(DateTimeField, 'DD.MM.YYYY mm.hh'))) As Date

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
dmohanty
Partner - Specialist
Partner - Specialist

Hi,

Can you try this:

 

= date(datefield,'DD.MM.YYYY')

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Be careful. Date() does not discard the time values, it simply formats the date time field to not display the time part. Use Floor() to truncate the date time field to get rid of the time portion.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

I saw its more than "12.08.2013 10:45". It's "12.08.2013 10:45:10.000000000"

Not applicable
Author

like:

Select id,

          name,

          =date(datefield,'DD.MM.YYYY')

FROM table;

or how do I use the "="?

er_mohit
Master II
Master II

tRY THIS IN TEXT OBJECT

=SubField('12.08.2013 10:45.10000000000000',' ',1)

You 'll got the Date

or in script you can do this way

load

id,

  name,

subfield(datefield,' ',1) as Date

FROM table;

Not applicable
Author

I tried your expressions but i didnt get it working

tresesco
MVP
MVP

Have you tried using floor() function, as suggested by Jonathan Dienst  ? That should work fine. If all above not working, please share a sample file.

Not applicable
Author

My Code:

ODBC CONNECT TO [xxx](xxx,xxx)

SQL SELECT Id,

                    action,

                    DATETIME     //Sample: 12.08.2013 14:30:30.000000000

                    Date(Floor(Date#(DATETIME, 'DD.MM.YYYY mm.hh'))) As Date

FROM XX."XX";

Then I got an error.

Script Error....     Ausdruck fehlt

Scripr Error....      Expression wrong