A date cannot be "remaining". Remaining can be the time span, for example from the current time to some stated date such as deadline. Here is how can it look in C#:
int RemainingDays(System.DateTime setTime) {
System.TimeSpan span = System.DateTime.Now - setTime;
return span.Days;
}
If you need to get time from the date represented as string, read about the following methods:
System.DateTime.Parse(string)
;System.DateTime.Parse(String, IFormatProvider, DateTimeStyles)
;System.DateTime.ParseExact(String, String, IFormatProvider)
; (you can use System.Globalization.CultureInfo
as IFormatProvider
);System.DateTime.ParseExact(String, String, IFormatProvider, DateTimeStyles)
;System.DateTime.ParseExact(String, String[], IFormatProvider, DateTimeStyles)
See:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[
^].
—SA