如何转换英文和法文日期

how to convert date in English and French(如何转换英文和法文日期)
本文介绍了如何转换英文和法文日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的表格中存储格式化的显示日期.例如,我的日期是 20150621,我希望它是 2015 年 6 月 21 日和 2015 年 6 月 21 日(法语).

I am trying to store formatted display dates in my tables. For example, I have a date as 20150621 and I want it as June 21, 2015 and 21 juin 2015 (for French).

我有一个查询:convert(varchar(12),cast([datecolumn]) as datetime),107)

这输出: Jun 21,2015 ,但我需要 June 21,2015 和法语日期.

This outputs: Jun 21,2015 , but I need June 21,2015 and also French date.

我使用的是 Sql 2005,因此格式在其中不起作用.

I am using Sql 2005, so format doesn`t work in it.

推荐答案

Write as:

    SELECT DATENAME(MM, CAST([datecolumn] AS DATETIME))
       + RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) 
       AS [Month DD, YYYY]
from test

Go

SET LANGUAGE French
SELECT CONVERT(VARCHAR(12),CAST(datecolumn AS DATETIME),106) as [DD MON YYYY]
from test

演示

这篇关于如何转换英文和法文日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)