According to usages, tm_mon (month) field has origin 1, not 0. This is
difference from C-library version of struct tm, which has origin 0 for
real.
For example:

```C
if (DateOrder == DATEORDER_DMY)
    sprintf(str, "%02d/%02d", tm->tm_mday, tm->tm_mon);
else
    sprintf(str, "%02d/%02d", tm->tm_mon, tm->tm_mday);
in src/backend/utils/adt/datetime.c

```
---
 src/include/pgtime.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/include/pgtime.h b/src/include/pgtime.h
index dcd0730..52b54b9 100644
--- a/src/include/pgtime.h
+++ b/src/include/pgtime.h
@@ -28,7 +28,7 @@ struct pg_tm
  int tm_min;
  int tm_hour;
  int tm_mday;
- int tm_mon; /* origin 0, not 1 */
+ int tm_mon; /* origin 1, not 0! */
  int tm_year; /* relative to 1900 */
  int tm_wday;
  int tm_yday;


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to