%@ Page language="c#" %>
timeLeft
Days, hours, and minutes left this year
<%
string msg, days, hours, minutes;
DateTime rightnow, newYears;
TimeSpan timeSpan;
// Set date/time of right now and new years day
rightnow = DateTime.Now;
newYears = new DateTime(2012, 1, 1);
// Compute the difference in time/dates
timeSpan = newYears.Subtract(rightnow);
// Compute and display the differences in days, hours, and minutes
days = timeSpan.Days.ToString();
msg = string.Format("Days: {0}, ", days);
Response.Write(msg);
hours = timeSpan.Hours.ToString();
msg = string.Format("Hours: {0}, ", hours);
Response.Write(msg);
minutes = timeSpan.Minutes.ToString();
msg = string.Format("Minutes: {0}
", minutes);
Response.Write(msg);
%>