## How to get the first day of any month

 Author Message lefrancisco1 Grasshopper Group: General Forum Members Points: 22 Visits: 79 Hi Folks, How to get the first ay of any month, Normally we will concatenate '01' TO DATE FUNTION and set 01 as the default first day of the month.bUT FOR EVERY MONTH I SHOULD GET FIRST DAYEXAMPLE; firstday of the month is 01 with their datename(week day) arun.sas Ten Centuries Group: General Forum Members Points: 1237 Visits: 3493 HI,TRY THIS`select getdate() + (1 - DAY(getdate()))select DATENAME(weekday,(getdate() + 1 - DAY(getdate())))` Jack Corbett SSChampion Group: General Forum Members Points: 11014 Visits: 14858 Here's a link to a blog post by Lynn Pettis that I refer to whenever I need a date routine. Jack CorbettApplications Developer Don't let the good be the enemy of the best. -- Paul FlemingAt best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at workCheck out these links on how to get faster and more accurate answers: Forum Etiquette: How to post data/code on a forum to get the best helpNeed an Answer? Actually, No ... You Need a QuestionHow to Post Performance ProblemsCrosstabs and Pivots or How to turn rows into columns Part 1Crosstabs and Pivots or How to turn rows into columns Part 2 Michael Valentine Jones Hall of Fame Group: General Forum Members Points: 3254 Visits: 11771 `select FirstDayOfMonth = dateadd(mm,datediff(mm,0,getdate()),0)`Results:`FirstDayOfMonth -----------------------2009-08-01 00:00:00.000` Saravanan_tvr SSC Veteran Group: General Forum Members Points: 292 Visits: 1347 select getdate() + ((1 - DAY(getdate()))) If today is 01 then it wont work to pick first day of month.. Many Thanks!S.saravanan“I am a slow walker, but I never walk backwards- Abraham Lincoln”