SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    England
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    not sure what topic title should be..

    Hey.

    Im having some trouble varifying the date a user puts in. the way i made my site is:

    The user types a date into 3 different form inputs day, month and year.

    these are then put through the checkdate() function. Say all is correct, $deadline_date becomes that date i just varified. It then get put into a database. The problem comes when the user wants to edit the date he has entered, because the checkdate() function requires ($month, $day, $year), but all ive got is $deadline_date.

    How can i take the parts back out of the $deadline_date, so it can become $month $day and $year again?
    PS. If you can tell me what the word to use in the topic is ill change it :P

    thanks, Cobra

  2. #2
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hiya!

    what does one of the typical deadline_date string look like? is it for instance!

    23/11/04 ? what do you use to seperate the numbers?

    Mark

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    England
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the reply mark.

    it will look like this 11-11-2004, for example.

    Cobra

  4. #4
    SitePoint Enthusiast SТОRМ's Avatar
    Join Date
    Sep 2004
    Location
    Ukraine
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first thought that came to me was to use explode, example:

    $deadline = '11-11-2004';

    $exploded = explode('-', $deadline);

    then

    $exploded[0] - day
    $exploded[1] - month
    $exploded[2] - year

  5. #5
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SТОRМ
    The first thought that came to me was to use explode, example:

    $deadline = '11-11-2004';

    $exploded = explode('-', $deadline);

    then

    $exploded[0] - day
    $exploded[1] - month
    $exploded[2] - year
    Damn you...... you beat me to it!!! lol! Thats why I was finding out what seperated his date!

    Good work!


  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    England
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that works great, thanks.


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
  •