How to populate the current date and time stamp on to an html form????

Discussion in 'HTML' started by srini, Apr 14, 2004.

  1. srini

    srini Guest

    Hi experts,

    I am developing one html form for our intranet users. I have a field
    called "SubmitDate", which is a plain text field and when the user
    opens the form, the form should populate the submit date with the
    current date and time stamp in PST format. Example: 4/14/2004 9:39:59
    AM.
    This is California time.

    I know that we can use now() function in some scripting languages.
    Say, if I use JavaScript client-side code, how would I write that
    little piece of code?

    Can some one kindly send me the code part for populating a date field
    with the current date and time stamp?

    Thanks in advance,
    Srini
     
    srini, Apr 14, 2004
    #1
    1. Advertising

  2. srini

    Hywel Guest

    In article <>, schimata2
    @yahoo.com says...
    > Hi experts,
    >
    > I am developing one html form for our intranet users. I have a field
    > called "SubmitDate", which is a plain text field and when the user
    > opens the form, the form should populate the submit date with the
    > current date and time stamp in PST format. Example: 4/14/2004 9:39:59
    > AM.


    What's the point have having the user key that information in? Why not
    either get the server to write the value to the field when the HTML
    document is created, or add the functionality to server-side the form
    handler.

    > This is California time.


    There's nice.

    > I know that we can use now() function in some scripting languages.
    > Say, if I use JavaScript client-side code, how would I write that
    > little piece of code?


    http://tinyurl.com/2er7n

    >
    > Can some one kindly send me the code part for populating a date field
    > with the current date and time stamp?


    Do it server-side. If you do it on the client you may not get the
    date/time that you're expecting.

    --
    Hywel I do not eat quiche
    http://kibo.org.uk/
    http://kibo.org.uk/mfaq.php
     
    Hywel, Apr 14, 2004
    #2
    1. Advertising

  3. srini

    SpaceGirl Guest

    "srini" <> wrote in message
    news:...
    > Hi experts,
    >
    > I am developing one html form for our intranet users. I have a field
    > called "SubmitDate", which is a plain text field and when the user
    > opens the form, the form should populate the submit date with the
    > current date and time stamp in PST format. Example: 4/14/2004 9:39:59
    > AM.
    > This is California time.
    >
    > I know that we can use now() function in some scripting languages.
    > Say, if I use JavaScript client-side code, how would I write that
    > little piece of code?
    >
    > Can some one kindly send me the code part for populating a date field
    > with the current date and time stamp?
    >
    > Thanks in advance,
    > Srini


    uh huh... server side. Asuming ASP:

    <p> The current date/time is <%=now%>.</p>

    Never do this stuff client side. If the user has JS disabled, your site wont
    work.
     
    SpaceGirl, Apr 14, 2004
    #3
  4. Re: How to populate the current date and time stamp on to an htmlform????

    Quoth the raven named SpaceGirl:

    > "srini" <> wrote in message
    > news:...
    >
    >> Can some one kindly send me the code part for populating a date
    >> field with the current date and time stamp?

    >
    > uh huh... server side. Asuming ASP:
    >
    > <p> The current date/time is <%=now%>.</p>
    >
    > Never do this stuff client side. If the user has JS disabled, your
    > site wont work.


    And what if the visitor is in... Thailand? Or Newfoundland *?

    IMO, you shouldn't even have a time field on the form. Let your server
    do that. After all, it needs to validate the whole form anyway.

    * 4½ hours from Pacific time.
    --
    -bts
    -This space intentionally left blank.
     
    Beauregard T. Shagnasty, Apr 14, 2004
    #4
  5. srini

    Neal Guest

    On Wed, 14 Apr 2004 18:10:16 GMT, Beauregard T. Shagnasty
    <> wrote:


    > And what if the visitor is in... Thailand? Or Newfoundland *?


    I doubt the author wants to know the time at the user's home, but the time
    the data was submitted relative to other submissions. Local server time is
    fine for this purpose.

    It's only when you care what time it is at their house that this will be a
    problem - and why would you want to know that when accepting form data,
    really?
     
    Neal, Apr 14, 2004
    #5
  6. Re: How to populate the current date and time stamp on to an htmlform????

    Quoth the raven named Neal:

    > On Wed, 14 Apr 2004 18:10:16 GMT, Beauregard T. Shagnasty
    > <> wrote:
    >
    >> And what if the visitor is in... Thailand? Or Newfoundland *?

    >
    > I doubt the author wants to know the time at the user's home, but
    > the time the data was submitted relative to other submissions.
    > Local server time is fine for this purpose.


    That was part of my point. JavaScript will return the user's local
    time, which would be generally useless.

    > It's only when you care what time it is at their house that this
    > will be a problem - and why would you want to know that when
    > accepting form data, really?


    ...as I also pointed out. <g> If the author needs the time for some
    sort of first in, first out reason, the local server (if it _is_
    local) is the only method that should be used.

    --
    -bts
    -This space intentionally left blank.
     
    Beauregard T. Shagnasty, Apr 14, 2004
    #6
  7. srini wrote:

    > I am developing one html form for our intranet users. I have a field
    > called "SubmitDate", which is a plain text field and when the user
    > opens the form, the form should populate the submit date with the
    > current date and time stamp in PST format. Example: 4/14/2004 9:39:59
    > AM. This is California time.


    Form:
    http://www.goddamn.co.uk/tobyink/scratch/date

    Source code:
    http://www.goddamn.co.uk/tobyink/scratch/date-src

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Apr 14, 2004
    #7
  8. srini

    Neal Guest

    On Wed, 14 Apr 2004 18:20:07 GMT, Beauregard T. Shagnasty
    <> wrote:


    > That was part of my point.


    I must have misunderstood then.
     
    Neal, Apr 14, 2004
    #8
  9. srini

    Mitja Guest

    [...]
    > >> Can some one kindly send me the code part for populating a date
    > >> field with the current date and time stamp?

    [...]
    >
    > And what if the visitor is in... Thailand? Or Newfoundland *?
    >
    > IMO, you shouldn't even have a time field on the form. Let your server
    > do that. After all, it needs to validate the whole form anyway.
    >
    > * 4½ hours from Pacific time.


    Um... "I am developing one html form for our intranet users" and so on...
    Perhaps some TCP tunnelling?
     
    Mitja, Apr 14, 2004
    #9
  10. Re: How to populate the current date and time stamp on to an htmlform????

    Quoth the raven named Mitja:

    > [...]
    >
    >> And what if the visitor is in... Thailand? Or Newfoundland *?

    >
    > Um... "I am developing one html form for our intranet users" and so
    > on...


    Oh my. Sorry, I missed that word intranet. Damn, I hate it when that
    happens! There probably won't be many Thais or Newfies using the form.

    > Perhaps some TCP tunnelling?


    Perhaps. If the web page is being served on a company server, the
    simple asp or php as others have posted should suffice.

    --
    -bts
    -This space intentionally left blank.
     
    Beauregard T. Shagnasty, Apr 14, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QmVydA==?=

    Date/Time stamp in SQL

    =?Utf-8?B?QmVydA==?=, Jan 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    21,448
    Wardeaux
    Jan 30, 2004
  2. mark | r

    time and date stamp - start stop button?

    mark | r, Nov 30, 2005, in forum: ASP General
    Replies:
    3
    Views:
    152
    mark | r
    Nov 30, 2005
  3. Brave
    Replies:
    3
    Views:
    849
    Brave
    Jul 25, 2009
  4. Dr John Stockton

    Appending Date/Time Stamp to filename

    Dr John Stockton, Sep 26, 2004, in forum: Javascript
    Replies:
    0
    Views:
    121
    Dr John Stockton
    Sep 26, 2004
  5. James Bond 007

    Time stamp on HTML form submittal

    James Bond 007, Nov 9, 2004, in forum: Javascript
    Replies:
    4
    Views:
    158
    James Bond 007
    Nov 14, 2004
Loading...

Share This Page