mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I have a script which needs to be able to calculate a person's age based on the date entered for a date of birth. Using
set %age $calc($asctime($ctime($today),yyyy)-$asctime($ctime(%dob),yyyy))
works fine for dates on or after Jan 1 1970
any suggestions as to how I can do something similar for dates before Jan 1 1970?
The date of birth is not entered in any one specific format.

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
the big problem with that is of course using the identifiers $ctime and $asctime which are based on the elapsed seconds since Jan 1 1970.
to do what you want you will have to work out a way to compute the calendar yourself.
web page with some information

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks..too bad $ctime(text) won't give a negative number if the date (in text) was before Jan 1 1970

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Problems resolved...not as easily or simply as I would've liked (ie: getting a negative number when using $ctime with a date before Jan 1 1970, rather than $null), but I have managed to get around the problem. Thanks to all that helped.


Link Copied to Clipboard