Re: Postgres Date Type Value

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Postgres Date Type Value
Дата
Msg-id 89384.1671322850@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Postgres Date Type Value  (Michael Arnold <myk321@gmail.com>)
Список pgsql-general
Michael Arnold <myk321@gmail.com> writes:
> Something like this:

>   int32_t date_val = be32toh(*((uint32_t *) PQgetvalue(res, 0, 17)));

> Gives date_val=1,466,004,328 for 2022-10-25.

The origin is 2000-01-01 (I'm pretty sure that's documented somewhere),
so the correct integer value for that date is 8333 by my math.

Looking at the bit-pattern for 1,466,004,328: 0x57617368, it seems
totally unrelated, more like ASCII text ("Wash") than anything else.
You sure you're reading the right column of the result?

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Arnold
Дата:
Сообщение: Postgres Date Type Value
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Postgres Date Type Value