Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i add days to date time, heres my code

ProgressBar PROB = new ProgressBar();
       private void Window_Loaded(object sender, RoutedEventArgs e)
       {
           mdate.Content = DateTime.UtcNow.ToShortDateString();
           DateTime dt2 = Convert.ToDateTime(mdate.Content);
           dt2.Date.AddDays(1);
           cdate.Content = dt2.ToShortDateString();

           this.grid0.Children.Add(PROB);
       }


theres 2 labels 1 showing the current date and the other label is ment to be the current date but 1 day ahead of the current date, can anyone help?
Posted

I think you want:
dt2 = d2.Date.AddDays(1);
 
Share this answer
 
Comments
BobJanova 16-Jun-11 8:51am    
Simple, succinct, correct, 5
C#
DateTime dt = DateTime.UtcNow;
mdate.Content = dt.ToShortDateString();
cdate.Content = dt.AddDays(2).ToShortDateString();
 
Share this answer
 

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