473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Displaying Date Time in an input box

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
Jul 19 '05 #1
2 2171
<%
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 <an*******@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
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

Jul 19 '05 #2
"Jerry" <an*******@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
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.


Put quotes around the value of the attribute. You should get in the habit
of doing that for all attributes.

<input type="Text" name="Start_Time" value="<% =now %>" />

Regards,
Peter Foti
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul M | last post by:
Hi there, i hope someone can help me out here.. I have a input screen where i want the user to enter text in 2 different languages, english and macedonian. How is it possible to make the...
1
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time...
9
by: Shaiboy_UK | last post by:
Hi all, Hopefully something simple here. I have written a form that takes data from a text box and updates it into an Access database. However, I want to also pass the local user date and...
5
by: nbohana | last post by:
I have a windows form with several fields. One of the fields is a date. I use DateTimePicker to enter and format the date. In my SQL table the date si stored as follows "01/10/2005" and this is...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
2
by: gubbachchi | last post by:
Hi all, How will I change the color of the dates in the javascript calendar which already has some event entered for it. Like I have a form where the user enters the id and selects the date from...
11
by: dba | last post by:
Have been displaying data from database using html for some time but just recently trying to display data back to "form". Can't find answer. <form method="post" action="<?php echo $PHP_SELF;?>">...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.