Jump to content
We've recently updated our Privacy Statement, available here ×

Force the Date format of a parameter


diesis

Recommended Posts

I have a problem whe running a report using the Calendar input for a date parameter.

The date parameter Data_Inizio (2007-05.01) is passed to mysql so that the query gets executed as:

 

Code:

SELECT
...
FROM
...
WHERE fd_Data
BETWEEN
DATE('Tue May 01 00:00:00 CEST 2007')
AND
DATE('Sun May 06 00:00:00 CEST 2007')
...

 

Naturally this won't work, because mysql need the date in format like yyyy-mm-dd.

 

I've tried to convert the string to this format using:

 

Code:
[code]...
WHERE fd_Data
BETWEEN
DATE(STR_TO_DATE($P{Data_Inizio}, '%a %b %d %T CET %Y'))
AND
DATE(STR_TO_DATE($P{Data_Fine}, '%a %b %d %T CET %Y'))

 

The problem is that the string CET changes to CEST when Daylight saving changes, and for some monthes it works, and for some other not.

 

Suggestions ?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...