Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

Date Difference

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bbawa1@yahoo.com - 19 Jun 2007 00:27 GMT
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
Masudur - 19 Jun 2007 10:28 GMT
On Jun 19, 5:27 am, bba...@yahoo.com wrote:
> Hi,
>
[quoted text clipped - 20 lines]
>
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.