473,609 Members | 1,818 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 2027
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="<%=oToda y.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.c om...
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="<%=oToda y.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.demo n.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demo n.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
5207
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
4
5364
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 calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
2
4154
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 why it doesn't work? Thanks in advance Tjerk
9
2628
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 will work to clean the data, but I'm having trouble putting those rules into efficient SQL. The table that I'm dealing with has just under 9M rows and I may need to use similar logic on an even larger table, so I'd like something that can be made...
30
3664
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 seems unnecessarily long. For some while, the following approach has been given here :- function ValidDate(y, m, d) { // m = 0..11 ; y m d integers, y!=0
3
2563
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, IT.itemid, IT.date,
0
901
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 setting each time. Thanks, Faramarz
12
29443
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
2
1828
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? Thanks! phil --------------------------------
0
8083
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
8547
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
8224
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,...
1
6062
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
5517
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
4026
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...
0
4091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2535
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
1
1676
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.