Fill text box on form with specific date ?

Discussion in 'ASP General' started by David, Nov 2, 2004.

  1. David

    David Guest

    Hi,

    Quick question:

    Using ASP, If I have a text box on a form, how can I auto populate it
    when the form loads with the date of the current Friday, i.e.
    dd/mm/yyyy


    Thanks for your help



    David
     
    David, Nov 2, 2004
    #1
    1. Advertising

  2. David

    Evertjan. Guest

    David wrote on 02 nov 2004 in microsoft.public.inetserver.asp.general:
    > the date of the current Friday


    First you have to define "current".

    is that "next" or "last" Friday?


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress,
    but let us keep the discussions in the newsgroup)
     
    Evertjan., Nov 2, 2004
    #2
    1. Advertising

  3. David wrote:
    > Hi,
    >
    > Quick question:
    >
    > Using ASP, If I have a text box on a form, how can I auto populate it
    > when the form loads with the date of the current Friday, i.e.
    > dd/mm/yyyy
    >


    What do you consider to be the current Friday? 2004-10-29? Or 2004-11-5?
    I will assume it to be the first Friday to follow the current date.

    <%
    dim today,curFri
    curFri=date()
    do until weekday(curFri) = vbFriday
    curFri= dateadd("d",1,curFri)
    loop
    curFri = left("0" & day(curFri),2) & "/" & left("0" & month(curFri),2) & _
    "/" & year(curFri)
    %>
    <input value="<%=curFri%>">

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Nov 2, 2004
    #3
  4. Bob Barrows [MVP] wrote:
    > What do you consider to be the current Friday? 2004-10-29? Or
    > 2004-11-5? I will assume it to be the first Friday to follow the
    > current date.


    Certainly not if the current day is a Friday!



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Nov 3, 2004
    #4
  5. Dave Anderson wrote:
    > Bob Barrows [MVP] wrote:
    >> What do you consider to be the current Friday? 2004-10-29? Or
    >> 2004-11-5? I will assume it to be the first Friday to follow the
    >> current date.

    >
    > Certainly not if the current day is a Friday!
    >
    >


    :)
    handled it in the code even though I didn't express it in my assumption.

    Bob
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Nov 3, 2004
    #5
    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. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,300
    Michael Borgwardt
    May 30, 2004
  2. Matt MC
    Replies:
    2
    Views:
    524
    Thomas 'PointedEars' Lahn
    May 25, 2005
  3. Gnarlodious
    Replies:
    4
    Views:
    17,640
    elizas
    May 5, 2010
  4. dthmtlgod

    Fill Combo Box based on another Combo Box

    dthmtlgod, Nov 16, 2005, in forum: ASP General
    Replies:
    1
    Views:
    604
    Bob Barrows [MVP]
    Nov 16, 2005
  5. Matt MC
    Replies:
    2
    Views:
    168
    Thomas 'PointedEars' Lahn
    May 25, 2005
Loading...

Share This Page