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

Home Posts Topics Members FAQ

defualt date in JS

could you show me how to do defualt date in JS?

I'm asp guy I can do it in asp
asp
<%
today = now()
%>
<input type="text" name="today" value="<%=today%>>

Thanks
-Jay
Jul 20 '05 #1
3 2019
On Tue, 22 Jul 2003 11:26:47 -0400, "Kevin Song" <no@spam.com> wrote:
could you show me how to do defualt date in JS?

I'm asp guy I can do it in asp
asp
<%
today = now()
%>
<input type="text" name="today" value="<%=today%>>

Thanks
-Jay


To create a new date in JavaScript you create a new Date Object. You
can then manipulate the Date object as needed to create a date string
that you want as your text box value. Below is your example completed
but you will probably want the date in a different format.

oDate = new Date();
<%
var oToday = now()
%>
<input type="text" name="today" value="<%=oToday.toString()%>>

Here is a reasonably good reference:
http://developer.netscape.com/viewso...ateobject.html
P.Leggetter
www.leggsonline.co.uk
Jul 20 '05 #2
Jay
Thanks a lot!

"Phil Leggetter" <js@leggsonline.co.uk> wrote in message
news:g0********************************@4ax.com...
On Tue, 22 Jul 2003 11:26:47 -0400, "Kevin Song" <no@spam.com> wrote:
could you show me how to do defualt date in JS?

I'm asp guy I can do it in asp
asp
<%
today = now()
%>
<input type="text" name="today" value="<%=today%>>

Thanks
-Jay


To create a new date in JavaScript you create a new Date Object. You
can then manipulate the Date object as needed to create a date string
that you want as your text box value. Below is your example completed
but you will probably want the date in a different format.

oDate = new Date();
<%
var oToday = now()
%>
<input type="text" name="today" value="<%=oToday.toString()%>>

Here is a reasonably good reference:
http://developer.netscape.com/viewso...ateobject.html
P.Leggetter
www.leggsonline.co.uk

Jul 20 '05 #3
JRS: In article <g0********************************@4ax.com>, seen in
news:comp.lang.javascript, Phil Leggetter <js@leggsonline.co.uk> posted
at Tue, 22 Jul 2003 16:50:20 :-
Here is a reasonably good reference:
http://developer.netscape.com/viewso...ateobject.html


It is old; it does not have the UTC functions; it does not seem to
mention field rollover (e.g. Mar 1 -> Feb 28/29). While the author
mentions Summer Time, he forgets its transitions in doing date
arithmetic with 864e5. Otherwise OK.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #4

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

Similar topics

2
5200
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...
4
5345
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
2
4138
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
9
2621
by: Thomas R. Hummel | last post by:
Hello, I am importing data that lists rates for particular coverages for a particular period of time. Unfortunately, the data source isn't very clean. I've come up with some rules that I think...
30
3638
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
3
2560
by: captain | last post by:
Below is the sql for data with same date need to extract + or - 5 days data of same date also. How to also get data of + and - days related to same date. SELECT IM.Area, IM.Location,...
0
897
by: Faramarz Mortezaie | last post by:
I have installed a driver for a trainer kit. Is there any way that I can include the library that I am using as a defualt library. That way I don't have to include the library to a new project...
12
29423
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...
2
1822
by: Phillip Vong | last post by:
VB.Net and a simple aspx.net page. I have this simple code that puts Today's date in these 2 textboxes. Can some one tell me how to set these two boxes with yesterday's date excluding weekends?...
0
7260
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
7161
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
7525
tracyyun
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...
1
5089
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...
0
3234
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...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1596
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 ...
1
802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
bsmnconsultancy
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...

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.