Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Separate Date from Time

Dear All

I am a new user and I need your help for a rather easy ( for you ) problem.

I want to separate date from time.

In the past I was doing something like this :

Date (DateTime,'dd/mm/yyyy') As ShortDate

But now I can't find the date function. I am using the Version 9.00.7469.8 SR4.

Thank you very much

Kostas Stathis ( k.stathis@live.com )

1 Solution

Accepted Solutions
Not applicable
Author

Hi Kostas,

You can try the below. If you can send some examples of App_Date field from your SQL database, we can guide you better.

makedate(year(App_Date), month(App_Date), day(App_Date)) as ShortDate

Regards,

Sajeevan

View solution in original post

12 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Date function is there in version 9.

   Have a look at the help file.

   And its the only function to get the date out of a time stamp.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Kostas,

          Please try this....

       Date#(Date (DateTime,'dd/mm/yyyy') )As ShortDate

Regards,

Antony.

Not applicable
Author

Dear Kaushik

Below you can see the error message. The date function exists in the help file

date( expression [ , format-code ] ).

I am recieving data from an access 2007 database. I will try to use the same from SQL 2008 Sample DB.

Thank you for your instant response.

SQL Error:[Microsoft][ODBC Microsoft Access Driver] Wrong number of arguments used with function in query expression 'Date(App_Date,'dd/mm/yyyy''.

SQL Scriptline:

SQL State:37000

SQL SELECT

          App_Date,

          Date(App_Date,'dd/mm/yyyy') As ShortDate,

          App_ID,

  App_Notes,

  App_Time,

  ContactName,

  EstCost,

  FinCost,

  Job,

  Status

FROM Appointment

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Yes, the reason is sql date function takes only 1 parameter, where as qlikview date takes 2 parameter.

   Try below code.

   load *, Date(App_Date,'dd/mm/yyyy') As ShortDate;

  

SQL SELECT

          App_Date,

          App_ID,

  App_Notes,

  App_Time,

  ContactName,

  EstCost,

  FinCost,

  Job,

  Status

FROM Appointment

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Dear Antony

I have done this yesterday. The result is very strange. I am loosing the month.

I am expecting 11/07/2011 and the result is 11/00/2011 !!!

The Day and the Year are always correct but the month is always 00.

Regards Kostas

Not applicable
Author

Hi,

       Please send your application......

Not applicable
Author

I have just tried it. There is no error message BUT the result was 11/00/2011 the month is 00.

This the new script. I will spend some more time trying to find out what goes wrong. Unfortunately I have all the time in the world.

LOAD

          App_Date,

          Date(App_Date,'dd/mm/yyyy') As ShortDate,

          App_ID,

          App_Notes,

          App_Time,

          ContactName,

          EstCost,

          FinCost,

          Job,

          Status;

SQL SELECT App_Date,App_ID,App_Notes,App_Time,ContactName,EstCost,FinCost,Job,Status

From Appointment;

Thank you very much

Kostas

Not applicable
Author

Antony you can find posted ( as an answer to Kaushik ) the script.

Thanks

Kostas

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

   Make sure that the data is in proper way  in your database.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!