繁体   English   中英

Prisma:创建没有日期的时间戳字段

[英]Prisma: Create timestamp field without date

我想在我的表中以时间戳类型创建一个字段,但没有日期戳。 DateTime 类型生成带有日期戳的那个,但我不想要那个。 谁能帮我?

提前致谢! :)

使用时间字段time(stamp) 类型

select '2020-09-28 12:22'::timestamp::time;
time   
----------
 12:22:00

\d ts_test 
                         Table "public.ts_test"
  Column  |            Type             | Collation | Nullable | Default 
----------+-----------------------------+-----------+----------+---------
 ts_tz    | timestamp with time zone    |           |          | 
 ts       | timestamp without time zone |           |          | 
 ts_txt   | character varying           |           |          | 
 time_fld | time without time zone      |           |          | 

insert into  ts_test (time_fld) values ('2020-09-28 12:22');

select * from ts_test where time_fld is not null;
 ts_tz |  ts  | ts_txt | time_fld 
-------+------+--------+----------
 NULL  | NULL | NULL   | 12:22:00

时间戳将被截断为一个时间。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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