Displaying Date Time in an input box

Discussion in 'ASP General' started by Jerry, Feb 6, 2004.

  1. Jerry

    Jerry Guest

    With the following code I am trying to simply set and display the current date time in an input box. The input box will not accept a variable that contains any spaces (i.e., a space between date and time). It works if I hardcode a date time, but I need the current date time. The code also works as long as it is not within an input box (see 3rd line below)

    <tr><td align="right"><strong>Start Time:</strong></td><td align="left"><input type="Text" name="Start_Time" value=<% =now %> /></td> *THIS ONLY DISPLAYS DAT
    <td><% =now %></td> *THIS DISPLAYS BOTH DATE AND TIM
    </tr

    Any ideas on how to accomplish this

    Thanks
    Jerr
    Any ideas
     
    Jerry, Feb 6, 2004
    #1
    1. Advertising

  2. Jerry

    Steven Burn Guest

    <%
    Function GetItFromHere()
    Dim strDateandTime
    strDateandTime = now 'get date and time
    strDateandTime = Trim(strDateandTime) 'remove spaces
    GetItFromHere = strDateandTime 'pass it to the function returned
    End Function
    %>

    <input type="text" value="<%GetItFromHere%>">

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Jerry <> wrote in message
    news:...
    > With the following code I am trying to simply set and display the current

    date time in an input box. The input box will not accept a variable that
    contains any spaces (i.e., a space between date and time). It works if I
    hardcode a date time, but I need the current date time. The code also works
    as long as it is not within an input box (see 3rd line below).
    >
    > <tr><td align="right"><strong>Start Time:</strong></td><td

    align="left"><input type="Text" name="Start_Time" value=<% =now %> /></td>
    *THIS ONLY DISPLAYS DATE
    > <td><% =now %></td> *THIS DISPLAYS BOTH DATE AND TIME
    > </tr>
    >
    > Any ideas on how to accomplish this.
    >
    > Thanks,
    > Jerry
    > Any ideas
     
    Steven Burn, Feb 6, 2004
    #2
    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,278
    Michael Borgwardt
    May 30, 2004
  2. ashutosh
    Replies:
    3
    Views:
    9,004
    Andrew Thompson
    Jun 16, 2005
  3. cjl
    Replies:
    1
    Views:
    10,503
    Michael Winter
    Oct 31, 2005
  4. Kevin Frey
    Replies:
    0
    Views:
    618
    Kevin Frey
    Nov 30, 2006
  5. cjl
    Replies:
    7
    Views:
    183
    Thomas 'PointedEars' Lahn
    Oct 30, 2005
Loading...

Share This Page