Date Difference

  • Thread starter Thread starter bbawa1
  • Start date Start date
B

bbawa1

Hi,

I have a table which has a field ItemsReceived of type datetime. I
have a grid view which has two columns.


In first column i have to show the data from field ItemsReceived and
in second column I have to show
difference between Currenttime and date from ItemReceived. How can I
do that.


e'g


ItemRecieved Difference
6/13/2007 12:38am 1d 21h 45m
6/13/2007 3:54pm 1d 06h 10m
6/15/2007 12:26pm 34m


So the second coulmn displays the difference of current time minus
ItemRecieved. the format shouild be <mintues>m,
or<hours>h, <mintues>m, or <days>d.


How can I do that.


Thanks in advance
 
Hi,

I have a table which has a field ItemsReceived of type datetime. I
have a grid view which has two columns.

In first column i have to show the data from field ItemsReceived and
in second column I have to show
difference between Currenttime and date from ItemReceived. How can I
do that.

e'g

ItemRecieved Difference
6/13/2007 12:38am 1d 21h 45m
6/13/2007 3:54pm 1d 06h 10m
6/15/2007 12:26pm 34m

So the second coulmn displays the difference of current time minus
ItemRecieved. the format shouild be <mintues>m,
or<hours>h, <mintues>m, or <days>d.

How can I do that.

Thanks in advance



hi take a look


if (!IsPostBack)
{
Session["JustLoaded"] = DateTime.Now;
}
else
{
Session["PostBacked"] = DateTime.Now;
}

if (Session["JustLoaded"] != null && Session["PostBacked"] !=
null)
{
DateTime one = (DateTime)Session["JustLoaded"];
DateTime two = (DateTime)Session["PostBacked"];
TimeSpan span = two.Subtract(one);
string s = span.Days + "d " + span.Hours + "h " +
span.Minutes+ "m ";
}

see this can be done...
now apply your own technique to solve your problem

Thanks
Masudur
www.kaz.com.bd
http://munnacs.110mb.com
 
Back
Top