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

Date Format


  1. gertduvenage
    Member

    Is it possable to add a Date Format YYYY/mm/dd for selection in the field properties ,for the date field during design ? Thanks

    Posted 16 years ago #
  2. yuniar

    I'm afraid it's not possible to add that format into the field properties.
    At this moment, only two format supported:
    1) mm/dd/YYYY
    2) dd/mm/YYYY

    However, it is possible to 'translate' one of those format into 'YYYY/mm/dd'.
    So, simply add one of those format,,,and then the result would be 'YYYY/mm/dd'.

    Is this okay for you? If so, I'll let you know the hack.


    MachForm Founder

    Posted 16 years ago #
  3. gertduvenage
    Member

    Thanks 'yuniar'..it would be fine ! Please let me have the hack if you dont mind ? Thanks Gert

    Posted 16 years ago #
  4. redityo

    You have to modify 2 machform files to do so, you can follow on bellow instruction

    1. Search on "includes/view-function.php" between line 363 ~ 374, you'll find this code

    <span>
    	<input id="element_{$element->id}_1" name="element_{$element->id}_1"
     class="element text" size="2" maxlength="2"
    value="{$element->populated_value['element_'.$element->id.'_1']['default_value']}"
    type="text" /> /
    	<label for="element_{$element->id}_1">{$lang['date_mm']}</label>
    </span>
    <span>
    	<input id="element_{$element->id}_2" name="element_{$element->id}_2"
    class="element text" size="2" maxlength="2"
    value="{$element->populated_value['element_'.$element->id.'_2']['default_value']}"
    type="text" /> /
    	<label for="element_{$element->id}_2">{$lang['date_dd']}</label>
    </span>
    <span>
    	<input id="element_{$element->id}_3"
    name="element_{$element->id}_3" class="element
    text" size="4" maxlength="4"
    value="{$element->populated_value['element_'.$element->id.'_3']['default_value']}"
     type="text" />
    	<label for="element_{$element->id}_3">{$lang['date_yyyy']}</label>
    </span>

    replace with this one

    <span>
    	<input id="element_{$element->id}_3" name="element_{$element->id}_3"
    class="element text" size="4" maxlength="4"
    value="{$element->populated_value['element_'.$element->id.'_3']['default_value']}"
    type="text" />
    	<label for="element_{$element->id}_3">{$lang['date_yyyy']}</label>
    </span>
    <span>
    	<input id="element_{$element->id}_1" name="element_{$element->id}_1"
    class="element text" size="2" maxlength="2"
    value="{$element->populated_value['element_'.$element->id.'_1']['default_value']}"
    type="text" /> /
    	<label for="element_{$element->id}_1">{$lang['date_mm']}</label>
    </span>
    <span>
    	<input id="element_{$element->id}_2" name="element_{$element->id}_2"
    class="element text" size="2" maxlength="2"
    value="{$element->populated_value['element_'.$element->id.'_2']['default_value']}"
    type="text" /> /
    	<label for="element_{$element->id}_2">{$lang['date_dd']}</label>
    </span>

    2. Edit your "includes/entry-functions.php" on line 111 you will find this code

    $date_value = date("m/d/Y",strtotime($date_value));

    replace with

    $date_value = date("Y/m/d",strtotime($date_value));

    `


    MachForm Support

    Posted 16 years ago #
  5. gertduvenage
    Member

    Thanks a million !!!

    Posted 16 years ago #

RSS feed for this topic

Reply