C# Calculate Age Tutorial with Examples

C# Calculate Age Tutorial with Examples

Today, We want to share with you C# Calculate Age Tutorial with Examples.
In this post we will show you How to Calculate age from Date of Birth in C#, hear for Calculating age from date of birth – C# we will give you demo and example for implement.
In this post, we will learn about C# Calculate age from Date of Birth with an example.

Read Also:  Dynamically Upload Multiple Images Using PHP and jQuery

calculate someone’s age in C#

In this post, we will learn about how to calculate someone’s age in C# with an example.

My Paka Knowledgeable Ideas, Tips and Tricks, Useful Content, Jobs, Technology, Earn Money, gmail creation, skype, yahoo and more useful things.

Now in this post, I will explain how to calculate someone’s age in C# with appropriate example.

Now create Console Application in Visual Studio and write below lines of code in it.

Read Also:  PHP Laravel 6 Sub-domain routing file Example

using System;
using System.Collections;
using System.Collections.Generic;
namespace PakaInfo
    class Program
        static void Main(string[] args)
            DateTime _BirthDate = new DateTime(1991, 10, 29);
            DateTime _Now = new DateTime(2017, 12, 23);
            Console.WriteLine(string.Format("Age : {0}", GetAge(_BirthDate, _Now)));

        public static int GetAge(DateTime p_BirthDate, DateTime p_Now)
            int age = p_Now.Year - p_BirthDate.Year;

            if (p_Now.Month < p_BirthDate.Month || (p_Now.Month == p_BirthDate.Month && p_Now.Day < p_BirthDate.Day))

            return age;

Read :

Read Also:  How to get last record of database table in Laravel?


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about C# Calculate Age Tutorial.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

We hope This Post can help you…….Good Luck!.

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *