if you do Date1 - Date2 you will receive a TimeSpan object. This has a days
property which is the number of days between the two dates.
so:
txtDays.Text = ((Date1-Date2).Days + 1).ToString(); //Not sure you still
need the +1 here, I added as you have it below.
and for the log date:
txtLogdate.Text = DateTime.Now(ToString("dd-mmm-yyyy");
--
Thanks
Wayne Sepega
Jacksonville, Fl
Enterprise Library Configuration Console Module Generator
http://workspaces.gotdotnet.com/elccmg
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
"Vincent" <vh******@caribserve.net> wrote in message
news:#Q**************@TK2MSFTNGP14.phx.gbl...
Hi, in VB6 I have something like:
txtDays.Text = datediff("d",date1,date2)+1
txtLogdate.Text = format(Now,"dd-mmm-yyyy")
how do I write this in c# ?
Thanks