Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Actually i am getting Created_Date_Time from users table and saving in the string crtdt. now i want to add 30 min to that Created_Date_Time. is it possible in console application
Posted
Updated 20-May-13 22:40pm
v2

1 solution

Have a look at below example:

C#
DateTime currentTime = DateTime.Now;
currentTime = currentTime.AddMinutes(30);
Label.Text = currentTime.ToString();


Above code will add 30 minutes to the current datetime.
 
Share this answer
 
v2
Comments
ntitish 21-May-13 4:58am    
sir i had one more dought how to subtract the two date times in c# is it possible
Thanks7872 21-May-13 5:16am    
Subtract two datetime means? Do you need days between two dates?
ntitish 21-May-13 5:39am    
DateTime d1 = Convert.ToDateTime("5/21/2013 10:00");
DateTime d2 = DateTime.Now;
TimeSpan t = d1 - d2;
int d3 = Convert.ToInt32(t.TotalMinutes);

int d4 = Convert.ToInt32("4");
int d5 = Convert.ToInt32("5");

Now what i want is
int d6=d3/d4(with decimal values also)

is it possible
Thanks7872 21-May-13 5:41am    
what your target is?what you want to do?whats your aim?
ntitish 21-May-13 5:56am    
Sorry sir i think i am confusing u...i will explain clearly from the above example.
i want to subract the message_created_date_time and current_date_time that is called
(d1-d2) i will get one value d3. from database i am retrieving two column values d4 and d5, Now with that d4 i want to divide the d3 (d3/d4) result as d6 with this result i will give if condition if(d6 is not having decimal values after dividing) for example Condition1:-4/4=1,
Condition2:- 5/4=1.25
if(Condition 1 means it should go condition 2 means it should not go)
{
here i will send the notification
}

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