Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: Date format in the sql statement  (Read 3018 times)

Paul Traut

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Date format in the sql statement
« on: January 11, 2018, 04:38:20 pm »
Hi,

I have problems to create an sql statement
If I try something like this:
Code: [Select]
SELECT DISTINCT ID as OrderID, Name, ProductId, Creationdate
   FROM ttorders
   where productid = $D{products.productid} and creationdate >= '11/28/17 2:42 PM'
I get the error: ORA-01843:not a valid month.

If I try this:
Code: [Select]
SELECT DISTINCT ID as OrderID, Name, ProductId, Creationdate
   FROM ttorders
   where productid = $D{products.productid} and creationdate >= '2017-11-28 09:21:29'
I get the error: ORA-01861: literal does not match format string.

The Problem is:
This
Code: [Select]
'2017-11-28 09:21:29'is the format within my db and this
Code: [Select]
'11/28/17 2:42 PM'is how lime report shows me the date within the preview.

How can I filter my results depending on the date???

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: Date format in the sql statement
« Reply #1 on: January 11, 2018, 06:32:31 pm »
You have to convert  string according server language parameter, something like this:
creationdate>=to_date('2017-11-28 09:21:29', 'YYYY-MM-DD HH24:MI:SS','NLS_DATE_LANGUAGE = AMERICAN')