SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form Date Format

    Hi,

    I am currently updating my form. I have a query with respect to the date format. Previously, my date was divided into 3 individual fields (along the same line); day, month and year. When each time people submit the form to me by email, I will received the format as follows:

    day: 01
    month:07
    year:1955

    My new form update I hope to receive the format in one single line, such as the following format below with forward slashes in between them:

    date: 01/07/1955

    My question is, is there anyway to do that? is it possible using html? I don't know anything about php or javascript. Please help......Thanks

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,597
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    You could use JavaScript to add the slashes as they type the rest of the date. Using one field for dates can become a bit confusing though as there are a few people who insist on puting the day and month the wrong way around.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks stephen. I agree some people really put the day and month in the wrong way.
    How do I do it to put the slashes as well as date into one single filed line such as 01/07/1955 format in javascript? I don't anything about this javascript at all.

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haven't tested this myself, but have a look at this.

  5. #5
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    day and month the wrong way around
    Dates can be arch-nemeses when dealing with international websites, I gave up trying to figure out if people were talking about july 1 or january 7, and now all my dates are YYYY-MM-DD. Try and find a free popup calendar control for the user to enter the date, that takes a lot of ambiguity out of the process.

    http://www.google.ca/search?hl=en&q=...calendar&meta=

  6. #6
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi guys,

    Thanks for your response. Greatly appreciated. I will give it a try. Thanks

  7. #7
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,597
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    http://javascript.about.com/library/bldatesel1.htm may help get what you want. You can always rewrite the function at the bottom to construct whatever date format you want it to insert.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •