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>
</form>
How could I get to show the date 90 days later to the exact date and time.
I would enter the data in the first box and hit submit to show in the second
box.
TIA 21 1942
Samir said: 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> </form>
How could I get to show the date 90 days later to the exact date and time. I would enter the data in the first box and hit submit to show in the second box.
If you're not going to be sending the data to your server,
you shouldn't use a submit element. Use an input of type
"button", instead.
<input type="button"
value="Submit"
onclick="this.f orm.date2.value =plus90(this.fo rm.date1.value) ">
"T1" and "T2" (and "B1") are pretty bad names for form fields.
Why not at least "date1" and "date2"?
As for what the function I've called plus90() should do,
check the date manipulation links referenced in the FAQ: http://www.jibbering.com/faq/
You may want to rethink the input format.
It's a lot easier if the format is "Jun 15 2004 21:52:06".
Lee wrote on 19 aug 2004 in comp.lang.javas cript: Samir said: Say I put a date and time for like this: Jun-15-04 21:52:06
You may want to rethink the input format. It's a lot easier if the format is "Jun 15 2004 21:52:06".
A lot??
t = "Jun-15-04 21:52:06"
t = t.replace(/-(\d\d) /," 20$1 ").replace(/-/g," ")
[allows also last century as 19..]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Lee <RE************ **@cox.net> wrote:
Your From address does not specify a mailbox which is a violation of
Internet/Usenet standards and disregarding the Netiquette as well
as most certainly a violation of the Acceptable Use Policy of your
service provider.**You* have*been*warne d.
<http://www.interhack.n et/pubs/munging-harmful/> Samir said: 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> </form>
How could I get to show the date 90 days later to the exact date and time. I would enter the data in the first box and hit submit to show in the second box. If you're not going to be sending the data to your server, you shouldn't use a submit element. Use an input of type "button", instead.
Wrong. Using a submit button may also be useful without a server, if it
is used in an application using only client-side scripting and the required
DOM access methods are for some reason not available or viable. Example:
<http://pointedears.de/scripts/test/ObjectInspector/nightly/latest/index>
It would be more correct to say that using a submit button is not viable
if re-accessing or changing the container element's resource is undesired
which is the case here.
You may want to rethink the input format. It's a lot easier if the format is "Jun 15 2004 21:52:06".
Why?
PointedEars
--
Everyone thinks I'm psychotic, except for my friends deep inside the earth.
Evertjan. said: Lee wrote on 19 aug 2004 in comp.lang.javas cript:
Samir said: Say I put a date and time for like this: Jun-15-04 21:52:06
You may want to rethink the input format. It's a lot easier if the format is "Jun 15 2004 21:52:06".
A lot??
Yes: var firstDate=new Date("Jun 15 2004 21:52:06");
JRS: In article <cg*********@dr n.newsguy.com>, dated Wed, 18 Aug 2004
20:20:20, seen in news:comp.lang. javascript, Lee
<RE************ **@cox.net> posted : Samir said: Say I put a date and time for like this: Jun-15-04 21:52:06
How could I get to show the date 90 days later to the exact date and time.
As for what the function I've called plus90() should do, check the date manipulation links referenced in the FAQ: http://www.jibbering.com/faq/
You may want to rethink the input format. It's a lot easier if the format is "Jun 15 2004 21:52:06".
Samir is probably a foreigner (everybody is probably a foreigner on the
Internet). Can one be sure that in all browsers the form "Jun" is
recognised? AFAICS, ECMA is indecisive in such matters (ICBW); and not
all software is compliant with applicable standards - some foreign
software systems are configured with excessive localisation.
Accordingly, I would suggest instead 2004/06/15 21:52:06 xxx
where xxx is either absent, a well-known time zone indicator, or an
offset from GMT. The form is as close to ISO 8601 as my browser will
accept.
Unless users are restricted to odd places like China, Hawaii, Guam, the
ISS, Iceland, Morocco, and Ghana, etc., the OP needs to decide whether
the 90 days are to be of real time or of user's civil time.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demo n.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Okay here is my redited code
<form>
<p><input type="text" name="date1" size="20"><br>
date</p>
<p><input type="text" name="date2" size="20"><br>
90 days from date</p>
<p><input type="button" value="Submit" name="B1"
onclick="this.f orm.date2.value =plus90(this.fo rm.date1.value) "></p>
</form>
I can't seem to know how to do this, I couldn't find the function in the
page you have said. Can anyone else help me?
<script language="javas cript">
function plus90(){
??????????????? ??????????????? ?????
}
</script>
"Lee" <RE************ **@cox.net> wrote in message
news:cg******** *@drn.newsguy.c om... Samir said: 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> </form>
How could I get to show the date 90 days later to the exact date and
time.I would enter the data in the first box and hit submit to show in the
secondbox.
If you're not going to be sending the data to your server, you shouldn't use a submit element. Use an input of type "button", instead.
<input type="button" value="Submit" onclick="this.f orm.date2.value =plus90(this.fo rm.date1.value) ">
"T1" and "T2" (and "B1") are pretty bad names for form fields. Why not at least "date1" and "date2"?
As for what the function I've called plus90() should do, check the date manipulation links referenced in the FAQ: http://www.jibbering.com/faq/
You may want to rethink the input format. It's a lot easier if the format is "Jun 15 2004 21:52:06".
Samir wrote on 19 aug 2004 in comp.lang.javas cript: Okay here is my redited code
<form> <p><input type="text" name="date1" size="20"><br> date</p> <p><input type="text" name="date2" size="20"><br> 90 days from date</p> <p><input type="button" value="Submit" name="B1" onclick="this.f orm.date2.value =plus90(this.fo rm.date1.value) "></p> </form>
I can't seem to know how to do this, I couldn't find the function in the page you have said. Can anyone else help me?
<form>
<input type="text" name="date1" size="20"><br>
date (yyyy/mm/dd)<br><br>
<input type="text" name="date2" size="20" readonly><br>
90 days from date<br><br>
<input type="button" value="Calculat e"
onclick="plus90 (this);">
</form>
<script type="text/javascript">
document.forms( 0).date1.value = dateToString(ne w Date())
function dateToString(d) {
return [d.getYear(),d.g etMonth()+1,d.g etDate()].join('/')
}
function plus90(x){
d = new Date(x.form.dat e1.value)
d = new Date(d.getYear( ),d.getMonth(), d.getDate()+90)
x.form.date2.va lue = dateToString(d)
}
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
On 19 Aug 2004 19:39:10 GMT, Evertjan. <ex************ **@interxnl.net >
wrote:
[snip] function dateToString(d) { return [d.getYear(),d.g etMonth()+1,d.g etDate()].join('/') }
function plus90(x){ d = new Date(x.form.dat e1.value) d = new Date(d.getYear( ),d.getMonth(), d.getDate()+90)
Wouldn't
d = new Date(...);
d.setDate(d.get Date() + 90);
be simpler?
Also, getFullYear() is preferable to getYear().
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Michael Winter wrote on 19 aug 2004 in comp.lang.javas cript: Wouldn't
d = new Date(...); d.setDate(d.get Date() + 90);
be simpler?
Yes, more concise, but perhaps not as clear to the OP.
Also, getFullYear() is preferable to getYear().
Why, in this case?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: androtech |
last post by:
Hello,
I'm looking for a function that returns a date range for a specified week
number of the year.
I'm not able to find functions like this anywhere. Any pointers/help would
be much appreciated.
TIA
|
by: Khurram |
last post by:
I have a problem while inserting time value in the datetime Field.
I want to Insert only time value in this format (08:15:39) into the SQL
Date time Field.
I tried to many ways, I can extract the value in timeonly format by using
this command
Format(now,"HH:mm:ss")
But when I insert it into the Sql Server database, it embadded date value
with it.
the output looks like that "01/01/1900 08:59:00" in that case time is
|
by: maflatoun |
last post by:
Hi,
I have the following function to convert UTC time to Local time. It
works perfect for GMT- (Minus) time zones however it provides incorrect
results for GMT+(Plus) time zones?
// Format to local time from UTC
function formatToLocalTimeDate(inDate) {
var today = new Date();
var inDateMod = new Date(inDate);
|
by: Assimalyst |
last post by:
Hi,
I have a working script that converts a dd/mm/yyyy text box date entry
to yyyy/mm/dd and compares it to the current date, giving an error
through an asp.net custom validator, it is as follows:
function doDateCheckNow(source, args)
{
var oDate = document.getElementById(source.controltovalidate); //
dd/mm/yyyy
|
by: Luvin lunch |
last post by:
Hi,
I'm new to access and am very wary of dates as I have limited
experience in their manipulation and I know if they're not done
properly things can turn ugly quickly.
I would like to use a calendar control to allow my users to enter a
date but I need them to enter a time as well. It doesn't look like the
calendar control will allow times to be entered so I was thinking of
having two text boxes. One text box would contain the date...
| |
by: Jim in Arizona |
last post by:
I have a gridview that's being populated from an access db query. The
problem I'm having is that the date/time fields in access that are
populating the gridview are showing both date and time, when the field
should only be showing one or the other (date or time).
Even on the back end of the database where the column properties are, I
have chosen the smallest date/time formats. When the aspx page runs, it
shows the date and time (ie:in a...
|
by: colleen1980 |
last post by:
Hi: Data in my table is in that format. How to i separate date with
time.
11/9/2006 10:10:46 AM
Thank You.
|
by: Geoff Cox |
last post by:
Hello,
at the moment I can add the combined date and time into MySQL using
php
$dt1 = date("Y-m-d H:i:s");
is it possible to add the date and time separately?
I thought it might be
|
by: yasirmturk |
last post by:
Standard Date and Time Functions
The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any formatting considerations at all.
They are simple, easy, and brief and you should use them any time you need to incorporate any date literals or date math in your T-SQL code.
create function DateOnly(@DateTime DateTime)
-- Returns @DateTime...
|
by: ahmurad |
last post by:
Dear Brothers,
I am struggling the following four Date-Time type values which were inputted into MYSQL database in different tables. As
MYSQL Default Time Format: YYYY-MM-DD HH:MM:SS, So I used the MYSQL Tables DateTime Type as Text.
Time-formet 1. 04:02:27 16/01/2009
Time-formet 2. 16/01/2009 13:53:19
Time-formet 3. 00901E+13
Time-formet 4. Wed Jan 14 00:09:09 BDT 2009
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |