Click here to Skip to main content
15,921,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi I want to display a time on label which is of after 24 hours of the current system time
I am working in Asp.net Using C# visual studio 2008
please guide me how to build this logic?
Posted
Updated 7-Oct-10 19:39pm
v2

Look at the following;

newDate = System.DateTime.Now.AddHours(24);

Also, look at the other methods available in the above classes for formatting etc.
 
Share this answer
 
System.DateTime.Now.AddHours(24).ToString("MM/dd/yyyy");
Or
System.DateTime.Now.AddDays(1).ToString("MM/dd/yyyy");
Or
System.DateTime.Now.Date.Add(TimeSpan.FromDays(1)).ToString("MM/dd/yyyy");
 
Share this answer
 
Comments
Toli Cuturicu 8-Oct-10 14:45pm    
Already answered.
hii


Please Try this:-


Step1:- In my case,take a Label(Label1) in my form

Step 2:- Write the following code on the Page_Load:-

protected void Page_Load(object sender, EventArgs e)
{
Label1.Text=System.DateTime.Now.AddHours(24).ToShortTimeString();
}
 
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