Re: Converting a TimestampTz into a C# DateTime

From: Arjen Nienhuis <a(dot)g(dot)nienhuis(at)gmail(dot)com>
To: valeriof <valerio_farruggio(at)hotmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Converting a TimestampTz into a C# DateTime
Date: 2016-11-14 17:56:54
Message-ID: CAG6W84LzZQYj4WanqqvEh-3fDq0XJ=aR2fBsaiwBXr=BuA=L1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Nov 14, 2016 12:53, "valeriof" <valerio_farruggio(at)hotmail(dot)com> wrote:
>
> Hi,
> I'm handling a TimestampTz value inside a plugin to stream WAL changes to
a
> .NET client application. What I'm trying to do is to return all possible
> column changes as binary (don't like to have Postgres handle the
conversion
> to string as I may need to have access to the bytes at the client level).
In
> case of a TimestampTz, is it possible to return the 8-bytes long integer
and
> then from the C# application convert the value to Ticks?

Npgsql supports the binary COPY protocol. Their implementation is here:

https://github.com/npgsql/npgsql/blob/dev/src/Npgsql/TypeHandlers/DateTimeHandlers/TimeStampHandler.cs

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Poul Kristensen 2016-11-14 18:21:01 C code with embedded SQL
Previous Message Albe Laurenz 2016-11-14 15:38:37 Re: Converting a TimestampTz into a C# DateTime