下面的SQL语句
SELECT getdate()
go当我从SQL Server management studio运行时,它提供了
"Jul 27 2016 22:00:00.860"当我在sqsh中运行同样的命令时,它给出了
"Jul 27 2016 10:00PM"sqsh使用freetds从我的linux机器连接到SQL server。我有一个C程序,它使用freetds,它将很好地工作时,日期是24小时格式检索。
我猜有一些设置可以让freetds获得所需格式的日期,可以有人建议如何通过freetds设置来实现这一点吗?
发布于 2016-08-01 17:38:20
这是我刚刚在我的ubuntu linux机器上做的事情:
在bash shell中键入以下命令:LANG=en_US
sudo cp /usr/share/doc/freetds-common/examples/locales.conf /etc/freetds/
locale locales.conf file to the config directory:sudo cp /usr/share/doc/freetds-common/examples/locales.conf /etc/freetds/
[en_US]
;date format = %b %e %Y %I:%M:%S:%z%p
date format = %Y-%m-%d %H:%M:%S
现在我从sqsh得到了
SELECT getdate();
: 2016-08-01 11:37:45发布于 2016-07-28 11:36:05
目前,在locales.conf文件中配置了FreeTDS返回的默认日期格式。详情请参见http://www.freetds.org/userguide/locales.htm。
https://stackoverflow.com/questions/38615458
复制相似问题