OLEDB日期(时间)的问题asp.net C# [英] OLEDB date(time) issue asp.net c#
问题描述
我已经写了一个小帮手的Excel工作正常。它使用此连接字符串:
I have written a little excel helper which works fine. It uses this connection string:
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<FILENAME>;Extended Properties=\"Excel 12.0;HDR=Yes;\";";
不幸的是,当我部署code,细胞,其中包含一个日期字符串像这样: 28/12/2008
返回为: 12/25/2008 12:00:00 AM
,而不是 25/12/2008 00:00:00
使用后的ToString 。我调整了机器的时区等(所有的机器现在英国时区),但这并没有改变任何东西。我只是好奇,什么决定OLEDB如何'行为。其目的是要获得 25/12/2008 00:00:00
在两台机器上。
Unfortunately when I deploy the code, cells, which contains a date string like this: 28/12/2008
are returned as: 12/25/2008 12:00:00 AM
rather than 25/12/2008 00:00:00
after using ToString. I adjusted the time zone etc. of the machine (all machines are now UK time zones) but this hasn't changed anything. I am just curious what determines how OLEDB 'behaves'. The aim would be to get 25/12/2008 00:00:00
on both machines.
谢谢!
基督教
推荐答案
我认为这可能是一个做的文化
被设置为 EN-US
。您需要格式化的DateTime
相应。
I think that this might be something to do with the Culture
being set to en-us
. You would need to format the DateTime
accordingly.
这篇关于OLEDB日期(时间)的问题asp.net C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!