-
|
I am using postgresql, pgadmin4 v9.3 and SQLPage v0.34.0 Calling sqlpage file with this url http://localhost:8080/do_report?SDate=1/4/25&EDate=30/4/25&PDate= In this file I have this code If $EDate='30/4/25' the set operation fails with error
If If I put the sql shown in the error message
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
This is a classic date format localization issue in PostgreSQL. Here's what's happening: The ProblemPostgreSQL's date parsing behavior depends on the The format
SolutionsOption 1: Use Unambiguous Date Format (Recommended)Change your URL to use ISO format or a clearly unambiguous format: Then your SQL becomes: Option 2: Explicit Date ParsingUse PostgreSQL's Option 3: Set DateStyle in SQLPage ConnectionYou can set the datestyle in the connection initialization script. In Option 4: Handle Multiple FormatsFor maximum flexibility, you could create a function to try multiple formats: RecommendationI'd strongly recommend Option 1 - using ISO date format (
The discrepancy you're seeing between pgAdmin and SQLPage is likely due to different See: |
Beta Was this translation helpful? Give feedback.
-
|
Obvious when explained - thank you so much |
Beta Was this translation helpful? Give feedback.
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
datestylesetting. 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/25is ambiguous - it could be:Solutions
Option 1: Use Unambiguous Date Format (Recommended)
Change your URL to use ISO format or a clearly unambiguous format:
Then your SQL becomes: