在SQL中如何将日期和时间与日期时间分开?
2019-09-05 23:07:16.643 我想分别获得2019-09-05和23:07:16.643。您可以查看此链接并使用您喜欢的对话格式 sql中的类似内容在SQL中如何将日期和时间与日期时间分开?,sql,Sql,2019-09-05 23:07:16.643 我想分别获得2019-09-05和23:07:16.643。您可以查看此链接并使用您喜欢的对话格式 sql中的类似内容 select convert(varchar, getdate(), 111) as OnlyDate, convert(varchar, getdate(), 8) as OnlyTime 对于c 由于假设数据库未知,我们可以尝试通过在空间之前和之后拆分日期时间来操纵日期时间 Select SUBSTR(datetime
select convert(varchar, getdate(), 111) as OnlyDate, convert(varchar, getdate(), 8) as OnlyTime
对于c
由于假设数据库未知,我们可以尝试通过在空间之前和之后拆分日期时间来操纵日期时间
Select SUBSTR(datetime,1,
Instr(datetime, ' ')) as date,
Substr(datetime, Instr(datetime, ' ')+1,
length(datetime)) as time from table
请提供您迄今为止尝试过的内容。另外,如果这只是关于SQL,那么为什么这个问题被标记为C?C解决方案可以吗?错误可能与sry重复。这是我在这个平台上的第一个问题,我想用SQL来解决这个问题。你用的是哪种产品?SQL只是一种查询语言,而不是特定数据库产品的名称。请查看您正在使用的数据库产品postgresql、oracle、sql server、db2。。。
Select SUBSTR(datetime,1,
Instr(datetime, ' ')) as date,
Substr(datetime, Instr(datetime, ' ')+1,
length(datetime)) as time from table