How old am I?

You want to express an age in years given the dob (mm/dd/yyyy) and today's date.

numero = 45
interpreted = N
texte =
[date][text]dob=04/24/1964[/text][!]Separate year in the format mm/dd/YYY into component parts [/!][math show=f]birthdatemonth=[getchars start=1&end=2][dob][/getchars][/math]
[math show=f]birthdateday=[getchars start=4&end=5][dob][/getchars][/math]
[math show=f]birthdateyear=[getchars start=7][dob][/getchars][/math]
[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] [/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] [age]
[date]

[text]dob=04/24/1964[/text]

[!]Separate year in the format mm/dd/YYY into component parts [/!]

[math show=f]birthdatemonth=[getchars
start=1&end=2][dob][/getchars][/math]

[math show=f]birthdateday=[getchars
start=4&end=5][dob][/getchars][/math]

[math show=f]birthdateyear=[getchars start=7][dob][/getchars][/math]


[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]
[/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]
[age]

DOWNLOAD WEBDNA NOW!

Top Articles:

WebDNA Modules

A list of the currently available modules...

Download WebDNA Applications

WebDNA applications...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

F.A.Q

A compilation of some user's questions...

WebDNA Libraries

A list of available libraries for WebDNA...

Tips and Tricks

A list of user-submitted tips ...

Related Readings:

Hideif on IP range

This will show or hide stuff according to the IP...

How to keep the text variable after a function has finished

By default...

How to setup CODA to work with WebDNA?

This page will show graphically how to setup CODA as a WebDNA partner :-)...

Calculating Standard Deviation

...

Handling credit card numbers

Encrypting the credit card numbers does the job quite nicely...

Formatting a long list in a table

How to show the result of a search as a table...