Skip to content

Instantly share code, notes, and snippets.

@Dalstroem
Created May 29, 2017 06:50
Show Gist options
  • Save Dalstroem/21c5dd2d8fb92479969318085d0dd7c6 to your computer and use it in GitHub Desktop.
Save Dalstroem/21c5dd2d8fb92479969318085d0dd7c6 to your computer and use it in GitHub Desktop.
Calculate age
var today = DateTime.Now; // 2017-05-29
var birthday = new DateTime(1988, 2, 26);
var age = (int)(today - birthday / 10000); // 29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment