473,671 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Putting date and time in input feild of form?!?!

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 time
using date() and time() JavaScript commands, but can't find the right syntax
to put them in the input command, example:
<input name=date value="<javascr ipt command here">

Can anyone help?

Thanks in advance.

Cheers
Shaiboy_UK

Jul 23 '05 #1
9 2542
Shaiboy_UK wrote:
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 time
using date() and time() JavaScript commands, but can't find the right syntax
to put them in the input command, example:
<input name=date value="<javascr ipt command here">

<body onload="documen t.forms[0].date.value=new Date()">
....
<input name=date type="text">

Mick
Jul 23 '05 #2
Lee
Mick White said:

Shaiboy_UK wrote:
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 time
using date() and time() JavaScript commands, but can't find the right syntax
to put them in the input command, example:
<input name=date value="<javascr ipt command here">

<body onload="documen t.forms[0].date.value=new Date()">
...
<input name=date type="text">


But realize that this is the date and time as set on the visitor's
desktop, which may have no relationship to reality. In fact, the
time reported by the browser may not even match what the visitor sees
on their desktop.

Jul 23 '05 #3
Lee wrote:
Mick White said:


<body onload="documen t.forms[0].date.value=new Date()">
...
<input name=date type="text">

But realize that this is the date and time as set on the visitor's
desktop, which may have no relationship to reality. In fact, the
time reported by the browser may not even match what the visitor sees
on their desktop.


True...
Mick
Jul 23 '05 #4
"Mick White" <mw***********@ rochester.rr.co m> wrote in message
news:qm******** ***********@twi ster.nyroc.rr.c om...
<body onload="documen t.forms[0].date.value=new Date()">
...
<input name=date type="text">

Mick


Hi Mick,

Tried, but doesn't seem to work. Put it on my testscripts folder at:
http://www.theukserver.net/testscript/readdate.html
have a look, and let me know.

Thanks in advance.

Cheers
Shaiboy_UK
Jul 23 '05 #5
Shaiboy_UK wrote:

Tried, but doesn't seem to work. Put it on my testscripts folder at:
http://www.theukserver.net/testscript/readdate.html
have a look, and let me know.


<html>
<body onload="documen t.forms[0].date.value=new Date()">
<form>
<input type="text" name="date">
</form>
</html>

It's preferable to use "new Date()", rather than "Date()" as you have.
Mick
Jul 23 '05 #6
JRS: In article <qm************ *******@twister .nyroc.rr.com>, dated
Fri, 14 Jan 2005 14:07:18, seen in news:comp.lang. javascript, Mick White
<mw***********@ rochester.rr.co m> posted :
Shaiboy_UK wrote:

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 time
using date() and time() JavaScript commands, but can't find the right syntax
Could be because neither date() nor time() exists.
to put them in the input command, example:
<input name=date value="<javascr ipt command here">

<body onload="documen t.forms[0].date.value=new Date()">
...
<input name=date type="text">


IMHO, while "date" is a perfectly legal name, it's not an ideal choice,
since it is too near "Date" to be typo-proof. "Today" would seem
better.

The date that goes into the Access database must be in a format that
Access considers appropriate; it's dangerous to assume that new Date(),
in any locality, will give a form that Access will accept specifically;
IIRC, the format of DateObj.toStrin g() is not actually defined.

Note : the OP is in UK, his application may be UK or wider. Sometimes,
though localised to UK, browsers give FFF dates; sometimes, though in
UK, browsers are not localised to UK (in our Public Library, last time I
looked, localisation was US; but most users might have preferred KR).

I don't know what Access can accept, with/without localisation; give the
date/time in ISO 8601:2004 if possible - YYYY-MM-DD hh:mm:ss; or
YYYY/MM/DD hh:mm:ss. Do not rely, except maybe on an intranet, on any
formats offered by javascript; build what you want in a localisation-
proof manner, unless you are satisfied that both products will always
localise compatibly.

See below.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #7
"Mick White" <mw***********@ rochester.rr.co m> wrote in message
news:M_******** ************@tw ister.nyroc.rr. com...

<html>
<body onload="documen t.forms[0].date.value=new Date()">
<form>
<input type="text" name="date">
</form>
</html>

It's preferable to use "new Date()", rather than "Date()" as you have.
Mick


Hi Mick,

Any way I could get the date and time in two boxes in the format of:
DD/MM/YY and HH:MM ? like in this format??
<input type="text" name="date">
<input type="text" name="time">

Thanks for this.

Cheers
Shaiboy_UK

Jul 23 '05 #8
Shaiboy_UK wrote:
"Mick White" <mw***********@ rochester.rr.co m> wrote in message
news:M_******** ************@tw ister.nyroc.rr. com...
<html>
<body onload="documen t.forms[0].date.value=new Date()">
<form>
<input type="text" name="date">
</form>
</html>

It's preferable to use "new Date()", rather than "Date()" as you have.
Mick

Hi Mick,

Any way I could get the date and time in two boxes in the format of:
DD/MM/YY and HH:MM ? like in this format??
<input type="text" name="date">
<input type="text" name="time">


<body
onload='with(do cument.forms[0]){date.value=th e.date;time.val ue=the.time}'>
<form>
<input type="text" name="date">
<input type="text" name="time">
</form>
<script type="text/JavaScript">
d=new Date()
the= {
date:d.getDate( )+"/"+(d.getMonth() +1)+"/"+d.getFullYear (),
time:d.getHours ()+":"+d.getMin utes()
}

</script>

Mick

Jul 23 '05 #9
"Mick White" <mw***********@ rochester.rr.co m> wrote in message
news:Oc******** **********@twis ter.nyroc.rr.co m...

<body
onload='with(do cument.forms[0]){date.value=th e.date;time.val ue=the.time}'>
<form>
<input type="text" name="date">
<input type="text" name="time">
</form>
<script type="text/JavaScript">
d=new Date()
the= {
date:d.getDate( )+"/"+(d.getMonth() +1)+"/"+d.getFullYear (),
time:d.getHours ()+":"+d.getMin utes()
}

</script>

Mick


Thanks Mike,

Cheers
Shaiboy_UK
Jul 23 '05 #10

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

Similar topics

5
3726
by: Dominique Javet | last post by:
Hello, I'm new to php and mysql and I use Dreamweaver MX 2004, so sorry for this "newbie" question... I've found no answer in the forum ... I've a date problem with my formular. In my mysql DB my filed "date" in table "experience" is like this: Y-m-d (2002-07-23). My fied`date` is date, NOT NULL with no default entry My form read well the date data depending the id, (pe. 30.02.2003), but when I submit a new date, I receive as result...
2
10204
by: Scott Knapp | last post by:
Good Day - I have a form which sets the current date, as follows: <script type="text/javascript"> xx=new Date() dd=xx.getDate() mm=xx.getMonth()+1 yy=xx.getYear() mmddyy=mm+"/"+dd+"/"+yy document.write(mmddyy)
21
1923
by: Samir | last post by:
Say I put a date and time for like this: Jun-15-04 21:52:06 Here is the form I am using: <form> <p><input type="text" name="T1" size="20"><br> date</p> <p><input type="text" name="T2" size="20"><br> 90 days from date</p> <p><input type="submit" value="Submit" name="B1"></p>
7
19611
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance, Don Following running on client-side:
8
25378
by: dlx_son | last post by:
Here is the code so far <form name="thisform"> <h3>Enter time to add to or subtract from:</h3> (If not entered, current time will be used)<br> Day: <input name="d1" alt="Day of month" size=3> Month: <input name="m1" alt="Month" size=3> Year: <input name="y1" alt="Year" size=5> (4 digits for year, e.g.
6
4841
by: MickG | last post by:
Hi, I am trying to validate these values, this seems to work fine for the phone number and name but I am trying to get the program to fail to submit and set the focus on the date when 2006 is selected and submitted. Thanks in advance for any help.
1
2010
by: nagamalli26 | last post by:
hai iam new php. i am creating admin side. i wrote this, phpcode: <?php //include_once("config.php"); $con=mysql_connect("localhost","root",""); mysql_select_db("happysalary"); ?>
4
6802
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form allows the employee to enter their UserID and select "Login" or "Logout" and then click a submit. When the submit button is clicked, I want the application to dum the NT Userename, UserID, status (Login or Logout) and a date/time stamp into an MS Access...
5
1830
by: jaemalegaon | last post by:
Hi , This Is Adarsh Jain Form Malegaon , A Remote Area In Dist Of Nashik, Maharastra(india), Wants Help In Arraning Data Record Of A Table According To Date Feild Of Data Record Of Same Table, I.e Suppose I Have Saves Data Recordenrty Of Cash Recipt On 2/10/2007 And Its Id No. Is Auto Created 1 But Later On I Have Saved Data Record Of Cash Receipt Of 1/10/2007 Then Its Auto Id No. Should Be 1 And Ealier One Should Be Ajusted To No. 2...
0
8400
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8823
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.