June 15, 201015 yr Anyone know how to get date of the 1st of current month? For example, todays date is 06/15/2010. I want calc. to produce date of 06/01/2010. Thank you!
June 15, 201015 yr dateField - Day ( dateField ) + 1 or for current date, make an unstored calculation (date ) using Get(CurrentDate) in place of your date field. UPDATE: How FM interprets ... dateField - Day ( dateField) produces date of 6/0/2010 which FM translates to the last day of the prior month. Then +1 brings the date forward to first day of this month. Technique learned from Comment quite some time ago and now replicated as one of the coolest techniques out there. Edited June 15, 201015 yr by Guest
June 15, 201015 yr Author Awesome tip! My final calc. looks like this: Get ( CurrentDate ) - Day (Get ( CurrentDate )) +1
June 16, 201015 yr You should also be aware of the date function: Date( Month; day; year) Like this: Date( month( get(currentDate)); 1; year( get( currentDate)) )
June 16, 201015 yr Author BruceR thank you. Very straight forward and clean, you're right, I do need to be aware of this.
June 16, 201015 yr Thanks. The date function is very useful and there are some cool but not-quite-obvious features. Like - how do you get the last day of the month? The last day of a month is day zero of the next month: date( 5 ; 0; 2007) result: 4/30/2007 date( 6; 366; 2010) result: 6/1/2011 Edited June 16, 201015 yr by Guest
Create an account or sign in to comment