如何在Sybase中将字符串转换为datetime

问题描述 投票:1回答:2

我有一个字符串,例如。 “2008-01-01 11:09:11”。

如何将其转换为日期时间?

sybase sybase-ase
2个回答
1
投票

如果您在SELECT语句或存储过程调用中将其用作文字字符串,则转换是自动的。

如果你在变量中得到它,convert(datetime, @stringDateTime)应该可以工作。


0
投票

timestamp数据类型定义为varbinary(8) null,它与时间或日期有任何关系。

您无法在sybase中将时间戳转换为日期时间。

© www.soinside.com 2019 - 2024. All rights reserved.