Hi,
I've encountered problem with date fields when i changed datestyle variable of my DB.
usually i work with datestyle=ISO, YMD, but now i needed
datestyle=SQL ,MDY
with such settings postgresql returns date fields like this: 1/14/2013
With such result i get 'Invalid argument to date encode'.
When i looked under the hood i found out that in ZSysUtils.pas
function TimestampStrToDateTime(String)
arbitrary decodes date in order Year, Month, Date.
With my text of '1/14/2013' i get Year=1, Month=14 and Day=2013 and this causes error.
Maybe this function should check ShortDateFormat to see what is order of date elements?
Best regards,
Marek
PostgreSQL date formatting error
Moderators: gto, EgonHugeist, olehs
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
markus,
that's an issue i was waiting for, Marek. Well the current way of Zeos allways adapts to the local settings. But there are some mor DBRMs like Oracle or MSSQL which can change the Data/Time-Format with the current session.
Another example: http://www.lazarus.freepascal.org/index ... 521.0.html
etc.
I was thinking several times about it. Your ShortDateFormat won't match all cases. Example: 11.11.11. What is year, Month, and day?
The datestyle you've changed: Is it session dependend?
IMHO a new Property like DateTimeFormat for our TZConnection or TZDataSet Components would be the best option. Any other, better proposals?
that's an issue i was waiting for, Marek. Well the current way of Zeos allways adapts to the local settings. But there are some mor DBRMs like Oracle or MSSQL which can change the Data/Time-Format with the current session.
Another example: http://www.lazarus.freepascal.org/index ... 521.0.html
etc.
I was thinking several times about it. Your ShortDateFormat won't match all cases. Example: 11.11.11. What is year, Month, and day?
The datestyle you've changed: Is it session dependend?
IMHO a new Property like DateTimeFormat for our TZConnection or TZDataSet Components would be the best option. Any other, better proposals?
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Michael,
You are right ShortDateFormat would be good if DB date formatting would be just like system locale settings, but it might be completely different
Your example is actually vey simple - it doesn't matter which field is year month or day;)
But property of connection is a good idea - it will be formated just as developer needs:)
Regards,
Marek
You are right ShortDateFormat would be good if DB date formatting would be just like system locale settings, but it might be completely different
Your example is actually vey simple - it doesn't matter which field is year month or day;)
But property of connection is a good idea - it will be formated just as developer needs:)
Regards,
Marek
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
markus,
But it shows clearly what i mean.
Well we've Zeos7.1-alpha and we can implement such a FormatSetting. But currently i'm running over all web-sites and bug-trackers to close issue reports or support some people with Zeos.
So it can take a while...
YES it was an example of a nerd!Your example is actually vey simple - it doesn't matter which field is year month or day;)
But it shows clearly what i mean.
Well we've Zeos7.1-alpha and we can implement such a FormatSetting. But currently i'm running over all web-sites and bug-trackers to close issue reports or support some people with Zeos.
So it can take a while...
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
markus,
i made a patch on 7.2. Simply adde Dateformat='mm-dd-yyy' to the Connection.Properties. Timeformat and DatetimeFormat is supported too now.
i made a patch on 7.2. Simply adde Dateformat='mm-dd-yyy' to the Connection.Properties. Timeformat and DatetimeFormat is supported too now.
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/