Re: Calculating Age from DB fields

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 54740
interpreted = N
texte = Hi, [showif [date %m]>[birthDateMonth]] [math show=f]age=[date %Y]-[birthDateYear][/math] [/showif] [showif [date %m]<[birthDateMonth]] [math show=f]age=([date %Y]-[birthDateYear])-1[/math] [/showif] [showif [date %m]=[birthDateMonth]] [showif [date %d]=[birthDateDay]] [math show=f]age=[date %Y]-[birthDateYear][/math] [math show=f]BirthdayToday=1[/math] [/showif] [showif [date %d]>[birthDateDay]] [math show=f]age=[date %Y]-[birthDateYear][/math] [/showif] [showif [date %d]<[birthDateDay]] [math show=f]age=([date %Y]-[birthDateYear])-1[/math] [/showif] [/showif] The above checks the users age to the day. Dale On Dec 7, 2003, at 3:01 PM, Palle Bo Nielsen wrote: > The code you wrote workes just fine, but I need to round the result > down. > > AgeInYears should be rounded down, and you can not do that with the > format tag or can you. Not according to the docs. > > Any help in rounding down? > > Palle > > > On 6/12-2003, at 16.36, Glenn Busbin wrote: > >>> Hi all, >>> >>> Some how my heads isn't working today, so I hope someone will be >>> helpful... >>> >>> I have a profile database with a lot of personal profile info >>> including these three fields >>> >>> db_date (01...31) >>> db_month (01...12) >>> db_year (1900...2010) >>> >>> I want to calculate the actual date based on todays date. >>> >> >> You mean you want to calc the *age*, right? >> >> Use days to date. >> >> AgeInDays=[Math]([Math]{[Date]}[/Math])-([Math]{[db_month]/[db_date]/ >> [db_year]}[/Math])[/Math] >> >> AgeInYears=[Math]AgeInDays/365.25[/Math] ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Calculating Age from DB fields ( Palle Bo Nielsen 2003)
  2. Re: Calculating Age from DB fields ( Palle Bo Nielsen 2003)
  3. Re: Calculating Age from DB fields ( "Dan Strong" 2003)
  4. Re: Calculating Age from DB fields ( "Dan Strong" 2003)
  5. Re: Calculating Age from DB fields ( "Dan Strong" 2003)
  6. Re: Calculating Age from DB fields ( CN Stuff 2003)
  7. Re: Calculating Age from DB fields ( Palle Bo Nielsen 2003)
  8. Re: Calculating Age from DB fields ( Palle Bo Nielsen 2003)
  9. Re: Calculating Age from DB fields ( Glenn Busbin 2003)
  10. Calculating Age from DB fields ( Palle Bo Nielsen 2003)
Hi, [showif [date %m]>[birthDateMonth]] [math show=f]age=[date %Y]-[birthDateYear][/math] [/showif] [showif [date %m]<[birthDateMonth]] [math show=f]age=([date %Y]-[birthDateYear])-1[/math] [/showif] [showif [date %m]=[birthDateMonth]] [showif [date %d]=[birthDateDay]] [math show=f]age=[date %Y]-[birthDateYear][/math] [math show=f]BirthdayToday=1[/math] [/showif] [showif [date %d]>[birthDateDay]] [math show=f]age=[date %Y]-[birthDateYear][/math] [/showif] [showif [date %d]<[birthDateDay]] [math show=f]age=([date %Y]-[birthDateYear])-1[/math] [/showif] [/showif] The above checks the users age to the day. Dale On Dec 7, 2003, at 3:01 PM, Palle Bo Nielsen wrote: > The code you wrote workes just fine, but I need to round the result > down. > > AgeInYears should be rounded down, and you can not do that with the > format tag or can you. Not according to the docs. > > Any help in rounding down? > > Palle > > > On 6/12-2003, at 16.36, Glenn Busbin wrote: > >>> Hi all, >>> >>> Some how my heads isn't working today, so I hope someone will be >>> helpful... >>> >>> I have a profile database with a lot of personal profile info >>> including these three fields >>> >>> db_date (01...31) >>> db_month (01...12) >>> db_year (1900...2010) >>> >>> I want to calculate the actual date based on todays date. >>> >> >> You mean you want to calc the *age*, right? >> >> Use days to date. >> >> AgeInDays=[math]([math]{[date]}[/Math])-([math]{[db_month]/[db_date]/ >> [db_year]}[/Math])[/Math] >> >> AgeInYears=[math]AgeInDays/365.25[/Math] ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ CN Stuff

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

encryption madness (2003) Out of the woodwork (2007) cart ID (1998) E-mail Attachments (1997) New WebDNA Forum Solution (in development) (2003) retain raw [cart] submitted value (2004) Lost Records in Database (2001) [OT] Xserve (2002) # fields limited? (1997) No Access warning when caching HTML files (1997) Help! WebCat2 bug (1997) Deleting Orders (1997) show all problem (1997) [OT] Theiving B*****ds (2004) [WebDNA] Strange error (2014) Comments in db? (1997) Re:redirect from the errorsMessages.db entry (1997) multi-paragraph fields (1997) Date search - yes or no (1997) snicker, snicker (1997)