Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
oseimuduame
Creator II
Creator 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
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this.

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

Sql Select * from xyz;

Regards,

Kaushik Solanki

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

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;

jpenuliar
Partner - Specialist III
Partner - Specialist III

Field Not Found:

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

oseimuduame
Creator II
Creator II
Author

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

jpenuliar
Partner - Specialist III
Partner - Specialist III

is this the same DashAlata.dbo.Orders ?

oseimuduame
Creator II
Creator II
Author

Yes. The same Table [My Order Table]

jpenuliar
Partner - Specialist III
Partner - Specialist III

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..

Anil_Babu_Samineni

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

o.CreatedDateTime

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ToniKautto
Employee
Employee

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?