Skip to content
Advertisement

Oracle, Make date time’s first day of its month

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

  • Eg: 10/10/2010 -> 01/10/2010
  • Eg: 31/07/2010 -> 01/07/2010

Advertisement

Answer

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

SELECT TRUNC(yourDateField, 'MONTH') FROM yourTable
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement