我想转换日期时间格式 [英] i want to convert datetime format

查看:62
本文介绍了我想转换日期时间格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
请帮助,我想转换日期时间格式.
在我的数据库日期中,以"mm/dd/yyyy"格式保存日期,但是我想以"dd/mm/yyyy"格式插入日期.....


在此先感谢.......

hi all,
plz help, i want to convert datetime format.
In my database date save in "mm/dd/yyyy" format but i want to insert date in "dd/mm/yyyy" format.....


Thanks in advance.......

推荐答案

尝试一下:
Try this:
SELECT CONVERT(VARCHAR(10), GETDATE(), 103) AS [DD/MM/YYYY]


转换DateTime [ ^ ]

转换DateTime [
Convert DateTime[^]

Convert DateTime[^]


您在数据库中的格式不是特定于文化的.特定于区域性的是对字符串的转换.如果您更改区域性,那么您将更改DataTime的格式.您需要做的就是改变文化.如果您将文化更改为美国,那么您将始终使用dd/mm/yy,而对于法国,它将是
Your format in the database is not culture specific. It is the conversion to a string that is culture specific. If you change the culture, then you change the format of the DataTime. What you need to do is change the culture. If you change the culture to US, then you will always be in dd/mm/yy, for France it would be
// C#
// Put the using statements at the beginning of the code module
using System.Threading;
using System.Globalization;
// Put the following code before InitializeComponent()
// Sets the culture to French (France)
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
// Sets the UI culture to French (France)
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");



只需更改为"zh-CN"



Just change to "en-US"


这篇关于我想转换日期时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆