sql - How can I switch the Month and Day when the column format is M/D/Y?
问题描述
I am not sure if this has already been answered but I could not find anything.
I am trying to convert the column of dates from MM/DD/YYYY
to DD/MM/YYYY
.
I must confess that I don't even know where to begin on this. I was thinking I might try an update statement but I am unsure as to how to format it. Any help would be appreciated.
解决方案
You need to do two level of conversation :
select convert(varchar(12), convert(date, datecol, 101), 103)
In general, you need to fix the data-type (if that is in your hand) instead of doing conversation in SQL
. Date formatting should be done at the presentation layer.
推荐阅读
- python - 需要拆分由多个分隔符分隔的文件内容并显示最长的长度行
- java - 如何检查两个图像是否与参考对象相似?
- php - 使用 PHP + cURL 通过 Mailgun API 发送带附件的电子邮件
- sql - 如何对一系列日期运行特定日期查询
- android - 写入文件系统花费的时间太长
- sql - MariaDB 中的 DATEADD
- css - PrimeNG 多选中 SelectItem 的 styleClass 属性
- npm - 在缓存或工作目录中找不到调试日志
- html - 列出数字和文本 css 之间的元素空间
- flutter - 图像在本地通知中显示为图标。如何在颤动中将图像显示为大图片样式?