Oracle,将日期时间设置为该月的第一天 [英] Oracle, Make date time's first day of its month

查看:46
本文介绍了Oracle,将日期时间设置为该月的第一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个datevariable,我想将其转换为该月的第一天,

I have a datevariable, I would like to have convert it to first day of its monh,

  • 例如:10/10/2010-> 2010年10月10日
  • 例如:2010年7月31日-> 2010年1月7日

推荐答案

根据 http://psoug.org/reference/date_func .html ,这应该可以使花花公子...

According to http://psoug.org/reference/date_func.html, this should work a dandy...

SELECT TRUNC(yourDateField, 'MONTH') FROM yourTable

这篇关于Oracle,将日期时间设置为该月的第一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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