Dr. Evil Posted June 15, 2010 Posted June 15, 2010 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!
LaRetta Posted June 15, 2010 Posted June 15, 2010 (edited) 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, 2010 by Guest
Dr. Evil Posted June 15, 2010 Author Posted June 15, 2010 Awesome tip! My final calc. looks like this: Get ( CurrentDate ) - Day (Get ( CurrentDate )) +1
bruceR Posted June 16, 2010 Posted June 16, 2010 You should also be aware of the date function: Date( Month; day; year) Like this: Date( month( get(currentDate)); 1; year( get( currentDate)) )
Dr. Evil Posted June 16, 2010 Author Posted June 16, 2010 BruceR thank you. Very straight forward and clean, you're right, I do need to be aware of this.
bruceR Posted June 16, 2010 Posted June 16, 2010 (edited) 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, 2010 by Guest
Recommended Posts
This topic is 5332 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now