www.webdeveloper.com
Results 1 to 3 of 3

Thread: Converting number to date format

  1. #1
    Join Date
    Jan 2011
    Posts
    2

    Converting number to date format

    I'm not too sure how to approach this but I have a date input that uses a jQuery pop-up for a calendar, and enters the date in a format d MMM yy (1 Jan 11).

    Not everyone wants to be clicking and choosing the date from the calendar but to be entering it just as a number such as 0101, 010111 or 01012011 which can be faster. This would then need to be converted to the d MMM yy format as per the jQuery pop-up when they exit the input box.

    So really only if it's a number format it needs to look at the number of digits... and does the conversion.

    Has anyone done something like this before? Or is there a link to how I could go about achieving this?

    Many thanks

    David

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    You _could_ go to the trouble of trying to test for which format the user is entering and then setting up several different formatting options depending upon input, but it would be kind of a pain.

    What about just checking to make sure that the user enters nn mmm yy format? You can do that with Regular Expression. Simple.

    ^_^

  3. #3
    Join Date
    Jan 2011
    Posts
    2
    Thanks for the reply.
    The input is used within dataentry so it's not so much for forcing the entry type but to allow them to enter the date in other ways if they prefer.
    Unfortunatley having validation on this would be more of a nuisance than a help.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles