Connecting Tech Pros Worldwide Forums | Help | Site Map

defualt date in JS

Kevin Song
Guest
 
Posts: n/a
#1: Jul 20 '05
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



Phil Leggetter
Guest
 
Posts: n/a
#2: Jul 20 '05

re: defualt date in JS


On Tue, 22 Jul 2003 11:26:47 -0400, "Kevin Song" <no@spam.com> wrote:
[color=blue]
>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
>[/color]

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
Jay
Guest
 
Posts: n/a
#3: Jul 20 '05

re: defualt date in JS


Thanks a lot!

"Phil Leggetter" <js@leggsonline.co.uk> wrote in message
news:g0nqhvg5rnndti3sctnf4v4e9fb10gn9cs@4ax.com...[color=blue]
> On Tue, 22 Jul 2003 11:26:47 -0400, "Kevin Song" <no@spam.com> wrote:
>[color=green]
> >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
> >[/color]
>
> 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[/color]


Dr John Stockton
Guest
 
Posts: n/a
#4: Jul 20 '05

re: defualt date in JS


JRS: In article <g0nqhvg5rnndti3sctnf4v4e9fb10gn9cs@4ax.com>, seen in
news:comp.lang.javascript, Phil Leggetter <js@leggsonline.co.uk> posted
at Tue, 22 Jul 2003 16:50:20 :-
[color=blue]
>Here is a reasonably good reference:
>http://developer.netscape.com/viewso...ateobject.html[/color]

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.
Closed Thread