You are here: Re: SQL needs AGE function. Age range selection Delphi/SQL/MS ACCESS solution. « PHP SQL « IT news, forums, messages
Re: SQL needs AGE function. Age range selection Delphi/SQL/MS ACCESS solution.

Posted by Skybuck Flying on 01/06/08 09:59

Delphi snippet:

DecodeDate( Now, vNowYear, vNowMonth, vNowDay );

vMinimumAge := 5;
vMaximumAge := 29;
vMinimumBirthDate := FormatDateTime('mm"/"dd"/"yyyy', EncodeDate(
vNowYear - (vMaximumAge+1), vNowMonth, vNowDay ) );

vMaximumBirthDate := FormatDateTime('mm"/"dd"/"yyyy', EncodeDate(
vNowYear - (vMinimumAge+1), vNowMonth, vNowDay ) );

SQL snippit:

AND
(
(BirthDate <> null) AND
(BirthDate > #01/01/1970#) AND
(BirthDate < #20/20/1980#)
);

Notes:

Surround date strings as follows for ms access date comparisions:

#date string#

Bye,
Skybuck.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация