简体   繁体   English

我可以在JavaDB上格式化TIME数据类型吗?

[英]Can I format TIME data type on JavaDB?

I have a TIME data type column in my database. 我的数据库中有一个TIME数据类型列。 According to this , it supports hh[:mm] {AM | 根据 ,它支持HH [:毫米] {AM | PM} format. PM}格式。 But when I tried insert this sql : 但是当我尝试插入此sql时:

INSERT INTO POSISI (ID, TUJUAN, PELABUHAN_TERAKHIR, LATLNG, AREA, KECEPATAN, HALUAN, STATUS, KETERANGAN, WAKTU, JAM) VALUES ((SELECT ID FROM KAPAL WHERE UPPER(KAPAL.NAMA)=UPPER('Aura Kasih')), 'Surabaya', 'Karimun', '2.02, 100.2', 'Kiclik', '19 knot', '11°', 'Anchor', 'Aman', '2014-03-16', '01:50 AM')

I got this on my database : 我在数据库上得到了这个:

2 | Surabaya | Karimun | 2.02, 100.2 | Kiclik | 19 knot | 11° | Anchor | Aman | 2014-03-16 | 01:50:00

As you can see, I am using 01:50 AM but it stored as 01:50:00 . 如您所见,我使用的是01:50 AM,但它存储为01:50:00

So, can I tell JavaDB to store TIME as hh:mm a format? 因此,我可以告诉JavaDB将TIME存储为hh:mm格式吗?

Thank you. 谢谢。

Time will always be stored as hh:mm:ss in the db. 时间将始终以hh:mm:ss的形式存储在数据库中。 The format that you mentioned is for the input. 您提到的格式用于输入。 You will need to format the time again when you want to retrieve / display from the db. 要从数据库检索/显示时,您将需要再次格式化时间。

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

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