Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Age Verification

Posted on December 16, 2013October 26, 2015 By David Kittell
private bool ValidateMemberUnderage(DateTime dtBirthday, int nYears)
		{
			if (DateTime.Today.Year - dtBirthday.Year > nYears)
				return true;
			else
				if (DateTime.Today.Year - dtBirthday.Year == nYears)
				{
					DateTime dtBirthdayThisYear = dtBirthday.AddYears(nYears);
					if (DateTime.Today >= dtBirthdayThisYear)
						return true;
					else
						return false;
				}
				else
					return false;
		}
if (ValidateMemberUnderage(DateTime.Parse("1981-04-04"), 12) == false)
		{
			MessageBox.Show("Too Young");
		}
		else
		{
			MessageBox.Show("Old Enough");
		}
Originally Posted on December 16, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code CSharp

Post navigation

Previous post
Next post

Related Posts

C# Date/Time String Conversion

Posted on December 13, 2013December 26, 2018

public string GetLongDate(string Date) { DateTime d = Convert.ToDateTime(Date); string format = "dddd,MMMM dd,yyyy"; string formatteddate = d.ToString(format); return formatteddate; } public string GetDOBDate(string Date) { DateTime d = Convert.ToDateTime(Date); string format = "MM/dd/yyyy"; string formatteddate = d.ToString(format); return formatteddate; } Originally Posted on December 13, 2013Last Updated on December…

Read More

Recover/Replace MySQL Root Password – UNIX

Posted on November 19, 2015December 30, 2016

Forgetting or never having the root password for a MySQL database can be rather difficult if it is now your job to support it. Note: You will need root access on the UNIX box to follow these commands. # Debian / Ubuntu sudo /etc/init.d/mysql stop # CentOS / Red Hat…

Read More

UNIX – Remove Apache, MySQL & PHP

Posted on October 30, 2015October 30, 2015

WARNING – THIS WILL REMOVE WITHOUT PROMPT dpkg -l *apache* *php* *mysql* phpmyadmin | grep ^ii | awk ‘{ print $2}’ | xargs sudo apt-get -y purge –auto-remove rm -r /etc/apache2 rm -r /etc/php5 rm -r /etc/mysql sudo apt-get –assume-yes purge apache* php* mysql* phpmyadmin sudo apt-get –assume-yes autoremove sudo…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes