Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

lakwinder
Contributor III

Change DateTime to Time

Hi, I'm newish to QV

I've loaded in data via Sql 2008 and QVD files.  One column has the datetime data type (im not allowed to change anything in the SQL DWH) i need to change it ro just Date in the QV.

What's the best and easiest way to do this.

Thanking you guys in advance.

1 Solution

Accepted Solutions
er_mohit
Honored Contributor II

Re: Change DateTime to Time

date(Datetime,'DD-MM-YYYY') as Date

For Time

Time(Datetime,'hh:mm:ss') as time

8 Replies
er_mohit
Honored Contributor II

Re: Change DateTime to Time

date(Datetime,'DD-MM-YYYY') as Date

For Time

Time(Datetime,'hh:mm:ss') as time

MVP & Luminary
MVP & Luminary

Re: Change DateTime to Time

Use the floor function to cut of the time part: floor(MyTimestamp) as MyDate


talk is cheap, supply exceeds demand
Not applicable

Re: Change DateTime to Time

If you change the format of date field, then try this

date(datetime,'DD/MM/YYYY')

now if you want to change its name then,

datetime as Date

vivientexier
Contributor II

Re: Change DateTime to Time

Hi,

Format or Value !

This 2 anwsers are corrects but the restult is different. You need to understand the difference.

Er.mohit give you a solution to change your field format. QlikView will present you a Date format but the value will still be a timestamp (date & time).

Gysbert Wassenaar change your field value from a timestamp to a date (no more time).

lakwinder
Contributor III

Re: Change DateTime to Time

Where do i add this?

date(Datetime,'DD-MM-YYYY) as Date

SQL

SELECT column_that_needs_changing(Datetime,'DD-MM-YYYY) as Date,

?

Thanks, nearly there

Not applicable

Re: Change DateTime to Time

in your script

where your clumn name present

example

load a,

b,

date(Datetime,'DD-MM-YYYY) as Date

from..

write this

lakwinder
Contributor III

Re: Change DateTime to Time

Thanks guys.

er_mohit
Honored Contributor II

Re: Change DateTime to Time

if your problem is resolved then you have to mark it either correct or helpful answer to closed this thread.so that it might be helpful for other developer.

Regards

Mohit