Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Contributor II

Converting DateTime to Date

Good Morning all,

     i have a Bottle-Neck that i am struggling with, i have a CreatedDateTime which i want to convert to just Date.

     i used    TO_CHAR(o.CreatedDateTime, DD-MM-YYYY) which is not working.

     please i need help on this.

Thank You.

15 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Converting DateTime to Date

Hi,

Try this.

Load *,Date(Floor(o.CreatedDateTime)) as NewDate;

Sql Select * from xyz;

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
Highlighted
Contributor II

Re: Converting DateTime to Date

Tried it, still no luck

Telling me

     Field not found - <o.CreatedDateTime>

here is what i want to INSERT it;

//Item Report

SELECT

  i.GroupCode as "ITEM_GROUP",

  o.MenuItemName as "MENU_ITEM_NAME",

  // To_CHAR(o.CreatedDateTime, 'DD-MM-YYYY') as "ORDER_DATE",

  //CONVERT(date[20], o.CreatedDateTime, dd/mm/yyyy) as "ORDER_DATE",

  o.Price as "MENU_ITEM_PRICE",

  o.Quantity as "MENU_ITEM_QTY"

FROM DashAlata.dbo.MenuItems i, DashAlata.dbo.Orders o

WHERE i.Id = o.MenuItemId;

Highlighted
Partner
Partner

Re: Converting DateTime to Date

Field Not Found:

Can you confirm that the Field [CreatedDateTime] exists in table Orders?

Highlighted
Contributor II

Re: Converting DateTime to Date

CreatedDateTime is in One Table[Order Table] in my Database

Highlighted
Partner
Partner

Re: Converting DateTime to Date

is this the same DashAlata.dbo.Orders ?

Highlighted
Contributor II

Re: Converting DateTime to Date

Yes. The same Table [My Order Table]

Highlighted
Partner
Partner

Re: Converting DateTime to Date

Why not perform the Date Conversion at the Preceeding Load (after your SQL script).

going back to your script issue, just to finally confirm field does exists, try querying just the fileds in Orders table:

SQL

SELECT

    o.MenuItemName as "MENU_ITEM_NAME",

    o.CreatedDateTime as "ORDER_DATE",

    o.Price as "MENU_ITEM_PRICE",

    o.Quantity as "MENU_ITEM_QTY"

FROM DashAlata.dbo.Orders o

;

after confirming the query runs ok, add your TO_CHAR() or maybe some other functions applicable, TO_DATE() ,  etc..

Highlighted

Re: Converting DateTime to Date

Please share the Data like two values. If you share the App that is very use ful

o.CreatedDateTime

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)
Highlighted
Employee
Employee

Re: Converting DateTime to Date

It sounds like you are asking for advice on how to compose the SQL query. Perhaps the database vendor has online help to guide you on the suitable function? Or are you having an issue with the data in QlikView?