简体   繁体   中英

Type to store time in C# and corresponding type in PostgreSQL

I would like to know how to store time in C# and PostgreSQL

Ex:

var startTime = 8.00;
var endTime = 9.20;
var total = endTime - startTime ;
toatl is 80min

And then store this value in a database.

In C# you can use DateTime and in PostgreSQL you can use the TIMESTAMP type.

EDIT

If you only need to store time, and not date, then you can use the TIME type. See also http://www.postgresql.org/docs/8.2/static/datatype-datetime.html .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM