N
Neon6mo ago
rising-crimson

Datetime

Hello guys, i'm new to neon. i try to build a local app with neon as the DB. i entry some data to a datagrid. when i data instert i keep track of it on my DB as Insert_date with DATE datatype. but i actually want to have the exact time not just the day it is inserted. can someone help me?
18 Replies
metropolitan-bronze
metropolitan-bronze6mo ago
Hi! In postgres, the TIMESTAMP_TZ is the recommended data type for keeping track of the time
modern-teal
modern-teal6mo ago
thanks for the reply.
modern-teal
modern-teal6mo ago
i cant see it here
No description
modern-teal
modern-teal6mo ago
should i write a query to create it?
metropolitan-bronze
metropolitan-bronze6mo ago
"Timestamp with time zone" is the long name for timestamp_tz
modern-teal
modern-teal6mo ago
oh i now get it
modern-teal
modern-teal6mo ago
i changed to it , created a new entry and i still get this. the time isnt right it like 12:00 not 3:00
No description
modern-teal
modern-teal6mo ago
in my code is use this
DateTime today = DateTime.UtcNow;
DateTime today = DateTime.UtcNow;
btd.Insert_Date = utcDateTime.ToString("yyyy-MM-dd HH:mm:ss");
btd.Insert_Date = utcDateTime.ToString("yyyy-MM-dd HH:mm:ss");
metropolitan-bronze
metropolitan-bronze6mo ago
What language/framework are you using?
modern-teal
modern-teal6mo ago
C# building a WinForms App
metropolitan-bronze
metropolitan-bronze6mo ago
:1010: ok let me search some docs
modern-teal
modern-teal6mo ago
ok mate. thanks in advance :chefskiss:
metropolitan-bronze
metropolitan-bronze6mo ago
Are you also using the Npgsql library?
modern-teal
modern-teal6mo ago
yeap, you are right i can provice you some code too, if it could help like how i insert the data in the database
metropolitan-bronze
metropolitan-bronze6mo ago
Yes please
modern-teal
modern-teal6mo ago
oh brother. i just found my mistake but thanks for telling me to use timestamp_tz
metropolitan-bronze
metropolitan-bronze6mo ago
Happy to help 🙂
modern-teal
modern-teal6mo ago
all good , have a nice day. thanks a lot :1010: :chefskiss:

Did you find this page helpful?