Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
if (date > DateTime.Now)


how to add 90 days to date

im looking for something like : if (date+90 days > DateTime.Now)

anyone can help me

What I have tried:

i don't know how to do that im new in coding
Posted
Updated 22-Jan-19 2:09am
Comments
Richard MacCutchan 22-Jan-19 7:54am    
Try reading the documentation before posting questions here.

C#
if (date.AddDays(90) > DateTime.Now)

DateTime.AddDays(Double) Method (System) | Microsoft Docs[^]
 
Share this answer
 
Comments
Maciej Los 23-Jan-19 7:50am    
5ed!
If this is related to your question from a few hours ago... How to change password help code[^]

You could also do it in your SQL Statements using the DateAdd function:
DATEADD (Transact-SQL) - SQL Server | Microsoft Docs[^]
SQL
SELECT PasswordExpirationDate = DATEADD(day, 90, PasswordChangedDate)
FROM   tblUser1
 
Share this answer
 
v2
Comments
el_tot93 22-Jan-19 8:10am    
thx i finally i did all what i want thank you

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