Skip to content

set variable problem with date type conversion #929

Closed Answered by lovasoa
lozdown asked this question in Q&A
Discussion options

You must be logged in to vote

This is a classic date format localization issue in PostgreSQL. Here's what's happening:

The Problem

PostgreSQL's date parsing behavior depends on the datestyle setting. When you run SQL directly in pgAdmin, it's using your local PostgreSQL session settings, but SQLPage may be connecting with different locale/datestyle settings.

The format 30/4/25 is ambiguous - it could be:

  • DD/MM/YY (UK format) = April 30, 2025
  • MM/DD/YY (US format) = Invalid (no 30th month)

Solutions

Option 1: Use Unambiguous Date Format (Recommended)

Change your URL to use ISO format or a clearly unambiguous format:

http://localhost:8080/do_report?SDate=2025-04-01&EDate=2025-04-30&PDate=

Then your SQL becomes:

set En…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by lozdown
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants