freecolours Posted July 26, 2003 Posted July 26, 2003 Maybe somebody has this calculation somewhere? I need to calculate the amount of days from a particular year (gYear = 2003) Anybody?
Lee Smith Posted July 26, 2003 Posted July 26, 2003 I'm sure we do, but I'm not sure what the results is suppose to be. What are you wanting for a result. Number of days from 2003 would be zero. Number of work days left in this 2003 would be 112, Number of days left in 2003 would be 158 Lee
freecolours Posted July 26, 2003 Author Posted July 26, 2003 Lee, Result needs to be a number; like: gYear = 2003 (has 365 days) = 365 or the same calculation for the amount of month days: gMonth = March, 2003 (has 31 days) = 31
kennedy Posted July 26, 2003 Posted July 26, 2003 365 + (not Mod(gYear, 400) or (Mod(gYear, 100) and not Mod(gYear, 4)))
kennedy Posted July 26, 2003 Posted July 26, 2003 Or for those who prefer less "mathematical" formulations: Case(not Mod(gYear, 400), 366, not Mod(gYear, 100), 365, not Mod(gYear, 4), 366, 365)
Ugo DI LUCA Posted July 27, 2003 Posted July 27, 2003 Hmm... DayOfYear(Date(12,31,gyear)) sounds simple too. For the Months, I'd go with (Date(gMonth+1, 1, gyear)) - Date(gMonth, 1, gyear) The number of days per year may also be : (Date(01, 01, gyear+1)) - Date(01, 01, gyear) Don't we always say FM has a thousands ways to go...
kennedy Posted July 27, 2003 Posted July 27, 2003 > DayOfYear(Date(12,31,gyear)) sounds simple too. Forgot about DayOfYear function... that's much better. > For the Months, I'd go with > > (Date(gMonth+1, 1, gyear)) - Date(gMonth, 1, gyear) Or using the same approach as DayOfYear... Day(Date(gMonth+1, 0, gYear)) > Don't we always say FM has a thousands ways to go... Indeed... in these cases there are several good ways... unfortunately in some, the several ways are trade-offs of the "least of several horrors".
Recommended Posts
This topic is 7859 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