简体   繁体   中英

SQL query for date format

我有一个dateFormat 2017-08-17T12:08:00(YYYY-MM-DD“ T” HH:MM:SS),我想将其转换为2017-08-17T00:00:00-05:00.Write在sql Developer上运行的sql查询。

if you are use sql server 8 or latest then u can use system function "FORMAT" like this :

SELECT FORMAT(GETDATE(),'yyyy-MM-dd"T"00:00:00-hh:MM')

Result : 2017-10-12T00:00:00-03:10

我认为您需要查看TO_CHAR(日期时间)函数,该函数可以将您的日期时间转换为指定格式的VARCHAR2数据类型。

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