开发者

Date format of sql from regional settings

I am reading date from the sql table. In sql table date time in the format how client set in regional format. Because of this reading date and splitting that and taking to a format what we want is becoming difficult. Is there any way to restrict sql date format from regional settings date format (means sql not suppose to take regional settings date format).

Now i got the answer:

string Date = Convert.ToDateTime(dateTimeString).ToString("yyyy-MM-dd");
string time = Convert.ToDateTime(dateTimeString).ToString("hh:mm:ss");

//dateTimeString--->my dateTime valu开发者_开发技巧e from sql database


If you write datetime fields using ISO 8601 there should be no problem.

That way, dates get formatted like "2011-09-26T12:04:00", so there's no misunderstanding possible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜