Difference between two dates in Weeks and Days

Discussion in 'ASP General' started by David, Jun 28, 2006.

  1. David

    David Guest

    Hi,

    I have an order processing system in which I have an OrderDate and a
    Completion Date

    I want to print the difference in Weeks and Days between the two dates,
    i.e. if the completion date is 3 weeks and 2 days after the order date,
    I want to print : 3 Weeks and 2 Days, on the page.
    Is this possible ?

    Appreciate your help


    Thanks
    David
     
    David, Jun 28, 2006
    #1
    1. Advertising

  2. David

    Evertjan. Guest

    David wrote on 28 jun 2006 in microsoft.public.inetserver.asp.general:

    > I have an order processing system in which I have an OrderDate and a
    > Completion Date
    >
    > I want to print the difference in Weeks and Days between the two dates,
    > i.e. if the completion date is 3 weeks and 2 days after the order date,
    > I want to print : 3 Weeks and 2 Days, on the page.
    > Is this possible ?
    >


    Yes.


    dif = DateDiff( "d", date1, date2 )

    weeks = fix( dif / 7 )

    restDays = abs( dif - ( weeks * 7 ) )

    result = weeks & " weeks and " & restDays & " days."

    [not tested]

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jun 28, 2006
    #2
    1. Advertising

  3. http://www.powerasp.com/content/new/function-reference-19.htm

    "David" <> wrote in message
    news:...
    > Hi,
    >
    > I have an order processing system in which I have an OrderDate and a
    > Completion Date
    >
    > I want to print the difference in Weeks and Days between the two dates,
    > i.e. if the completion date is 3 weeks and 2 days after the order date,
    > I want to print : 3 Weeks and 2 Days, on the page.
    > Is this possible ?
    >
    > Appreciate your help
    >
    >
    > Thanks
    > David
    >
     
    Kyle Peterson, Jun 29, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Henry
    Replies:
    6
    Views:
    16,173
    Brian Henry
    Nov 19, 2003
  2. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    868
    Rob Schieber
    Sep 30, 2005
  3. gops
    Replies:
    1
    Views:
    672
    Richard Heathfield
    Feb 10, 2004
  4. =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=

    difference (in days) of two dates

    =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=, Aug 23, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    335
    Hans Kesting
    Aug 23, 2007
  5. kirke

    list of days between two days

    kirke, Oct 19, 2006, in forum: Javascript
    Replies:
    7
    Views:
    138
    Julian Turner
    Oct 20, 2006
Loading...

Share This Page