Displaying Date Time in an input box

J

Jerry

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
 
S

Steven Burn

<%
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 said:
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).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top