Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to get past 15 years below dates from current date guide me or send any snippets
Posted

1 solution

In C#, use the AddYears method to subtract a specific number of years from the current date and time instance. For e.g.
DateTime newDate = DateTime.Now.AddYears(-15);

Javascript = try this -
C#
var myDate = new Date();
myDate.setFullYear (myDate.getFullYear() - 15);

This[^] could give you more ideas.
 
Share this answer
 
v3
Comments
Sandeep Mewara 21-Apr-12 7:21am    
My 5!
Abhinav S 21-Apr-12 7:35am    
Thank you Sandeep.
VJ Reddy 23-Apr-12 19:46pm    
Good answer. +5
Abhinav S 23-Apr-12 23:16pm    
Thank you VJ.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900