Jump to content

This topic is 7500 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Quick question:

I have a calculation field set to calculate age:

(TODAY - Current Date)/365.25

This works, but the field either rounds the age up or returns 32.99 years old or 18.24 years old, etc. How can I make this calculation field always round DOWN to the nearest full integer (no decimals or rounding up)?

Shane

Posted

isn't Today dead in 7? and isn't Today and Current Date the same Date?

I don't have 7, so this maybe easier. Here is the calculation I use in v6.

(Year(ReferenceDate) - Year(Birthday) - If((ReferenceDate) < Date(Month(Birthday), Day(Birthday), Year(ReferenceDate)), 1,0))&" "&"Years,"&" "& Mod(Month(ReferenceDate) - Month(Birthday) + 12 - If((Day(ReferenceDate) < Day(Birthday)),1,0),12)&" "&" months,"&" "&"and " & Round(Mod(Day(ReferenceDate) - Day(Birthday) + 30.42+1 - If((Day(ReferenceDate) < Day(Birthday)),1,0),31),0) &" days."

Text result.

Lee

  • Newbies
Posted

If you just want to see the years, this might work: Truncate( (Status(CurrentDate)-birthday)/365.25, 0). Use status (currentdate) not today() and make the field unstored if you can.

Hope this helps

Posted

The Floor function may be what you're looking for in version 7.

Here's a tweaked version of Lee's calc, combining the text that need not be separated, simplifying the already booleanized Ifs, and changing commas to semicolons for version 7, if this suits your needs...

Year(ReferenceDate) - Year(Birthday) - (ReferenceDate < Date(Month(Birthday); Day(Birthday); Year(ReferenceDate))) & " Years, " & Mod(Month(ReferenceDate) - Month(Birthday) + 12 - (Day(ReferenceDate) < Day(Birthday)); 12) & " months, and " & Round(Mod(Day(ReferenceDate) - Day(Birthday) + 30.42 + 1 - (Day(ReferenceDate) < Day(Birthday)); 31); 0) & " days"

Posted

Thank you Lee and Queue,

I justed needed the year only, so I modified and deleted the portion not needed. Also, Lee, I was wrong, I had TODAY listed as a field in my table referenced to the CurrentDate. Sorry.

Shane

This topic is 7500 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.