This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

[closed] Date field coming back 12/31/1969


  1. Al
    Member

    My orders keep coming back with the date field 12/31/1969. Any idea how to fix it?

    Posted 17 years ago #
  2. yuniar

    Hi Al,

    Can you tell me which form? and which field?

    Thanks


    MachForm Founder

    Posted 17 years ago #
  3. Al
    Member

    http://prayercardstore.com/machform/view.php?id=1

    The fields for
    1. Date of Birth
    2. Date of Death
    3. Date of Service
    4. Deliver ON or Before...

    I had to change them to "single line text" momentarily because it is live and being used by customers.
    I'll change it back for now so you can take a look.

    Posted 17 years ago #
  4. yuniar

    Ok, I found out that there is a bug for some system with PHP version < 5.
    The date was limited to 12/31/1969 and can't be any older.

    To fix this, we need to modify 2 files (includes/helper-functions.php and manage_entries.php)

    includes/helper-functions.php
    -----------------------------

    on line 326, search for this code:

    $email_data[$i]['value'] = ' - '.date("m/d/Y",strtotime($value));

    replace it with:

    $exploded_value = array();
    $exploded_value = explode("-",$value);
    $email_data[$i]['value']  = ' - '."{$exploded_value[1]}/{$exploded_value[2]}/{$exploded_value[0]}";

    on line 332, search this code:

    $email_data[$i]['value'] = ' - '.date("d/m/Y",strtotime($value));

    replace it with:

    $exploded_value = array();
    $exploded_value = explode("-",$value);
    $email_data[$i]['value']  = ' - '."{$exploded_value[2]}/{$exploded_value[1]}/{$exploded_value[0]}";

    manage_entries.php
    ------------------

    on line 251 and line 260, search for this code:

    $form_data[$i][$j] = date("Y/m/d",strtotime($row[$column_name]));

    replace it with:

    $exploded_value = array();
    $exploded_value = explode("-",$row[$column_name]);
    $form_data[$i][$j]  = "{$exploded_value[0]}/{$exploded_value[1]}/{$exploded_value[2]}";


    I hope I'm being clear for you.
    Let me know if you have any difficulty.


    MachForm Founder

    Posted 17 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.