defualt date in JS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Song

    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


  • Phil Leggetter

    #2
    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="<%=oToda y.toString()%>>

    Here is a reasonably good reference:



    P.Leggetter

    Comment

    • Jay

      #3
      Re: defualt date in JS

      Thanks a lot!

      "Phil Leggetter" <js@leggsonline .co.uk> wrote in message
      news:g0nqhvg5rn ndti3sctnf4v4e9 fb10gn9cs@4ax.c om...[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="<%=oToda y.toString()%>>
      >
      > Here is a reasonably good reference:
      > http://developer.netscape.com/viewso...ateobject.html
      >
      >
      > P.Leggetter
      > www.leggsonline.co.uk[/color]


      Comment

      • Dr John Stockton

        #4
        Re: defualt date in JS

        JRS: In article <g0nqhvg5rnndti 3sctnf4v4e9fb10 gn9cs@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.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.

        Comment

        Working...