Here's the code:
System.DateTime dtmStartDate =
new System.DateTime(2007,1,1);System.DateTime dtmFinishDate =
new System.DateTime(2007,9,1);System.TimeSpan intDays=dtmFinishDate.Subtract(dtmStartDate);
txtDays.Text=Convert.ToString( intDays );
System.DateTime dtmStartDate =
new System.DateTime(2007,1,1);System.DateTime dtmFinishDate =
new System.DateTime(2007,9,1);System.TimeSpan intDays=dtmFinishDate.Subtract(dtmStartDate);
txtDays.Text=Convert.ToString( intDays );
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mike GoldPosted Mar 19, 2007, 5:59 PM
I guess we are still a little confused at what you want to do because it's not clear in your question, so I'll attempt to guess and you can pick one of the options.
a) You want to populate a date time control with your own date time
reginald knightPosted Mar 19, 2007, 1:04 PM
Can anyone help: I'm trying to get the number of days entering my finish date. I'm getting an error passing the Year, Month, Day. I'm using academic visual studio 2003 c#
System.DateTime dtmStartDate = new System.DateTime(2007,1,1);
System.DateTime dtmFinishDate = new System.DateTime(dtmFinishDate.Year, dtmFinishDate.Month, dtmFinishDate.Day);
System.TimeSpan intDays=dtmFinishDate.Subtract(dtmStartDate);
txtDays.Text=Convert.ToString( intDays );
Adam GrandePosted Mar 17, 2007, 12:25 AM
reginald knightPosted Mar 15, 2007, 10:11 AM
I have tried passing it as this but doesn't work.
(dtmFinishDate.Year, dtmFinishDate.Month, dtmFinishDate.Day, 0,0,0);
Thanks
Adam GrandePosted Mar 14, 2007, 7:29 PM
cheers
adam
reginald knightPosted Mar 14, 2007, 10:29 AM
Adam GrandePosted Mar 13, 2007, 10:31 PM
System.TimeSpan ts = (finishtime.adddays(1)) - starttime
//rest of your code here
if im way off, please let me know and ill try to help some more
regards
adam
reginald knightPosted Mar 9, 2007, 9:59 AM
Mike: A few weeks ago I asked for help with the below method, and it worked fabulous,however, I'm having another problem being able to input my own FinishDate.
Thanks,
Reginald
System.DateTime dtmStartDate = new System.DateTime(2007, 1, 1);
System.DateTime dtmFinishDate = new System.DateTime(2007, 9, 1);
System.TimeSpan intDays = dtmFinishDate - dtmStartDate;
textBox1.Text = intDays.TotalDays.ToString();
-Mike GMike GoldPosted Feb 21, 2007, 7:32 PM
System.
DateTime dtmStartDate = new System.DateTime(2007, 1, 1);System.
DateTime dtmFinishDate = new System.DateTime(2007, 9, 1);System.
TimeSpan intDays = dtmFinishDate - dtmStartDate;textBox1.Text = intDays.TotalDays.ToString();
-Mike G