N
Neon7mo ago
rare-sapphire

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
probable-pink
probable-pink7mo ago
Hi! In postgres, the TIMESTAMP_TZ is the recommended data type for keeping track of the time
helpful-purple
helpful-purple7mo ago
thanks for the reply.
helpful-purple
helpful-purple7mo ago
i cant see it here
No description
helpful-purple
helpful-purple7mo ago
should i write a query to create it?
probable-pink
probable-pink7mo ago
"Timestamp with time zone" is the long name for timestamp_tz
helpful-purple
helpful-purple7mo ago
oh i now get it
helpful-purple
helpful-purple7mo 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
helpful-purple
helpful-purple7mo 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");
probable-pink
probable-pink7mo ago
What language/framework are you using?
helpful-purple
helpful-purple7mo ago
C# building a WinForms App
probable-pink
probable-pink7mo ago
:1010: ok let me search some docs
helpful-purple
helpful-purple7mo ago
ok mate. thanks in advance :chefskiss:
probable-pink
probable-pink7mo ago
Are you also using the Npgsql library?
helpful-purple
helpful-purple7mo 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
probable-pink
probable-pink7mo ago
Yes please
helpful-purple
helpful-purple7mo ago
oh brother. i just found my mistake but thanks for telling me to use timestamp_tz
probable-pink
probable-pink7mo ago
Happy to help 🙂
helpful-purple
helpful-purple7mo ago
all good , have a nice day. thanks a lot :1010: :chefskiss:

Did you find this page helpful?