================================================================================
Modification Name: Date-Time Format v1.2

Description:
This modification will change the input fields for the "Date Format" and "Time Format" in people's profiles and on the registration page. 
It will add a dropdown menu with a few default options using the current date/time as example.

Compatibility: XMB 1.9.8 SP3

Version: 1.2

Code Designed By: FunForum

Updated for 1.9.8 by: WormHole @ XMB Garage

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Notes: 
 - For your own safety, backup all effected files & templates before proceeding with this hack 
 - 2004 / 10 / 28 : Adjusted the instructions to the "XMB 1.9.1 Final - Nexus" coding.
 - 2006 / 01 / 31 : Checked over for compliancy for XMB 1.9.3 Final.
=================================================================================

Step 1.

Edit English.lang.php

======
Find:
======

$lang['dateformat'] = "Date Format (mm/dd/yyyy, dd-mm-yy, etc):";

============
Replace With:
============

$lang['dateformat'] = "Date Format:";

==========================
Add to bottom of the file above ?> :
==========================

// Date/Time Format Mod Begin
$lang['textseparator'] = "Separator";
$lang['selectdateformat'] = "Please select a Date Format";
$lang['selecttimeformat'] = "Please select a Time Format";
// Date/Time Format Mod End

-----------------------------------------------------------------------------------------------------------------------------------------------

Step 2.

Edit PHP File: editprofile.php

======
Find:
======

    $check12 = $check24 = '';
    if ($member['timeformat'] == 24) {
        $check24 = $cheHTML;
    } else {
        $check12 = $cheHTML;
    }

============
Replace With:
============

    // Date/Time Format Mod Begin
    $check12 = $check24 = '';
    if ($member['timeformat'] == 24) {
        $check24 = ' '.$selHTML;
    } else {
        $check12 = ' '.$selHTML;
    }
    $timeformatlist = '<select name="timeformatnew">
    <option value="24"'.$check24.'>'.gmdate("H:i", time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>
    <option value="12"'.$check12.'>'.gmdate("h:i A", time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>
    </select>';

    $dateseps = ".|#|-|#|_|#|/"; $datesep = explode("|#|", $dateseps);
    $dateseplist = '<select name="dateformatsepnew">';
    for($Fs = 0; $Fs < count($datesep); $Fs++) {
        if (false !== strpos($member['dateformat'], $datesep[$Fs])) {
            $dateseplist .= '<option value="'.$datesep[$Fs].'" '.$selHTML.'>'.$datesep[$Fs].'</option>';
        } else {
            $dateseplist .= '<option value="'.$datesep[$Fs].'">'.$datesep[$Fs].'</option>';
        }
    }
    $dateseplist .= '</select>';

    $dformats = "m.d.y|#|m.d.Y|#|d.m.y|#|d.m.Y|#|y.m.d|#|Y.m.d|#|y.d.m|#|Y.d.m|#|F jS, Y|#|jS of F Y";
    $dateformatlist = '<select name="dateformatnew">';
    $ffdfds=''; $dateformat = explode("|#|", $dformats);
    for($Fd = 0; $Fd < count($dateformat); $Fd++) {
        $find = array( 0 => '.', 1 => '-', 2 => '_', 3 => '/' ); $replace = array( 0 => '.', 1 => '.', 2 => '.', 3 => '.' );
        $member['dateformat'] = str_replace($find, $replace, $member['dateformat']);
        if ($member['dateformat'] == $dateformat[$Fd]) {
            $dateformatlist .= '<option value="'.$dateformat[$Fd].'" '.$selHTML.'>'.gmdate($dateformat[$Fd], time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>';
        } else {
            $dateformatlist .= '<option value="'.$dateformat[$Fd].'">'.gmdate($dateformat[$Fd], time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>';
        }
    }
    $dateformatlist .= '</select>';
    // Date/Time Format Mod End

======
Find:
======

    $bday = iso8601_date($year, $month, $day);

===========
Add Above:
===========

    // Date Time Format Mod Begin
    $dateformatnew = str_replace(".", $dateformatsepnew, $dateformatnew);
    // Date Time Format Mod End

----------------------------------------------------------------------------------------------------

Step 3.

Edit PHP File: member.php

======
Find:
======

                $avatd = '';

===========
Add Above:
===========

                // Date/Time Format Mod Begin
                $timeformatlist = '<select name="timeformatnew"><option value="12" selected>'.$lang['selecttimeformat'].'</option><option value="12"></option>
                <option value="24">'.gmdate("H:i", time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>
                <option value="12">'.gmdate("h:i A", time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>
                </select>';

                $dateseps = ".|#|-|#|_|#|/"; $datesep = explode("|#|", $dateseps);
                $dateseplist = '<select name="dateformatsepnew"><option value="-" selected>'.$lang['textseperator'].'</option><option value="-"></option>';
                for($Fs = 0; $Fs < count($datesep); $Fs++) {
                    $dateseplist .= '<option value="'.$datesep[$Fs].'">'.$datesep[$Fs].'</option>';
                }
                $dateseplist .= '</select>';

                $dformats = "m.d.y|#|m.d.Y|#|d.m.y|#|d.m.Y|#|y.m.d|#|Y.m.d|#|y.d.m|#|Y.d.m|#|F jS, Y|#|jS of F Y";
                $dateformatlist = '<select name="dateformatnew"><option value="Y.m.d" selected>'.$lang['selectdateformat'].'</option><option value="Y.m.d"></option>';
                $dateformat = explode("|#|", $dformats);
                for($Fd = 0; $Fd < count($dateformat); $Fd++) {
                    $dateformatlist .= '<option value="'.$dateformat[$Fd].'">'.gmdate($dateformat[$Fd], time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>';
                }
                $dateformatlist .= '</select>';
                // Date/Time Format Mod End

======
Find:
======

            $bday = iso8601_date($year, $month, $day);

===========
Add Above:
===========

            // Date/Time Format Mod Begin
            $dateformatnew = str_replace(".", $dateformatsepnew, $dateformatnew);
            // Date/Time Format Mod End

-----------------------------------------------------------------------------------------------------------------------------------------------

Step 4.

Edit PHP File: memcp.php

======
Find:
======

        $check12 = $check24 = '';
        if ($member['timeformat'] == 24) {
            $check24 = $cheHTML;
        } else {
            $check12 = $cheHTML;
        }

============
Replace With:
============

        // Date/Time Format Mod Begin
        $check12 = $check24 = "";
        if ($member['timeformat'] == 24) {
            $check24 = ' selected="selected"';
        } else {
            $check12 = ' selected="selected"';
        }
        $timeformatlist = '<select name="timeformatnew">
        <option value="24"'.$check24.'>'.gmdate("H:i", time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>
        <option value="12"'.$check12.'>'.gmdate("h:i A", time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>
        </select>';

        $dateseps = ".|#|-|#|_|#|/.";
        $datesep = explode("|#|", $dateseps);
        $dateseplist = '<select name="dateformatsepnew">';
        for($Fs = 0; $Fs < count($datesep);
        $Fs++) {
            if ( false !== strpos($member['dateformat'], $datesep[$Fs]) ) {
                $dateseplist .= '<option value="'.$datesep[$Fs].'" selected="selected">'.$datesep[$Fs].'</option>';
            } else {
                $dateseplist .= '<option value="'.$datesep[$Fs].'">'.$datesep[$Fs].'</option>';
            }
        }
        $dateseplist .= '</select>';

        $dformats = "m.d.y|#|m.d.Y|#|d.m.y|#|d.m.Y|#|y.m.d|#|Y.m.d|#|y.d.m|#|Y.d.m|#|F jS, Y|#|jS of F Y";
        $dateformatlist = '<select name="dateformatnew">';
        $ffdfds='';
        $dateformat = explode("|#|", $dformats);
        for($Fd = 0; $Fd < count($dateformat);
        $Fd++) {
            $find = array( 0 => '.', 1 => '-', 2 => '_', 3 => '/' );
            $replace = array( 0 => '.', 1 => '.', 2 => '.', 3 => '.' );
            $member['dateformat'] = str_replace($find, $replace, $member['dateformat']);
            if ($member['dateformat'] == $dateformat[$Fd]) {
                $dateformatlist .= '<option value="'.$dateformat[$Fd].'" selected="selected">'.gmdate($dateformat[$Fd], time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>';
            } else {
                $dateformatlist .= '<option value="'.$dateformat[$Fd].'">'.gmdate($dateformat[$Fd], time() + ($timeoffset * 3600) + ($addtime * 3600)).'</option>';
            }
        }
        $dateformatlist .= '</select>';
        // Date/Time Format Mod End

======
Find:
======

        $bday = iso8601_date($year, $month, $day);

===========
Add Above:
===========

        // Date/Time Format Mod Begin
        $dateformatnew = str_replace(".", $dateformatsepnew, $dateformatnew);
        // Date/Time Format Mod End

------------------------------------------------------------------------------------------------------------------------------------------------

Step 5.

Edit Template: admintool_editprofile

======
Find:
======

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$altbg2"><input type="radio" value="24" name="timeformatnew" $check24 />&nbsp;$lang[text24hour]&nbsp;<input type="radio" value="12" name="timeformatnew" $check12 />&nbsp;$lang[text12hour]</td>
</tr>
<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[dateformat]</td>
<td bgcolor="$altbg2"><input type="text" name="dateformatnew" size="25" value="$member[dateformat]" /></td>
</tr>

============
Replace With:
============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$THEME[altbg2]">$timeformatlist</td>
</tr>
<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[dateformat]</td>
<td bgcolor="$THEME[altbg2]">$dateformatlist&nbsp;$dateseplist</td>
</tr>
---------------------------------------------------------------------------------------------------------------------------------------------------

Step 6.

Edit Template: member_reg

======
Find:
======

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$altbg2"><input type="radio" value="24" name="timeformatnew" $timeFormat24Checked/>&nbsp;$lang[text24hour]&nbsp;<input type="radio" value="12" name="timeformatnew" $timeFormat12Checked />&nbsp;$lang[text12hour]</td>
</tr>
<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[dateformat]</td>
<td bgcolor="$altbg2"><input type="text" name="dateformatnew" size="25" value="$dformatorig" /></td>
</tr>

===========
Replace With:
===========

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$THEME[altbg2]">$timeformatlist</td>
</tr>
<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[dateformat]</td>
<td bgcolor="$THEME[altbg2]">$dateformatlist&nbsp;$dateseplist</td>
</tr>
----------------------------------------------------------------------------------------------------

Step 7.

Edit Template: memcp_profile

======
Find:
======

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$altbg2"><input type="radio" value="24" name="timeformatnew" $check24 />&nbsp;$lang[text24hour]&nbsp;<input type="radio" value="12" name="timeformatnew" $check12 />&nbsp;$lang[text12hour]</td>
</tr>
<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[dateformat]</td>
<td bgcolor="$altbg2"><input type="text" name="dateformatnew" size="25" value="$member[dateformat]" /></td>
</tr>

============
Replace With:
============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$THEME[altbg2]">$timeformatlist</td>
</tr>
<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[dateformat]</td>
<td bgcolor="$THEME[altbg2]" class="tablerow">$dateformatlist&nbsp;$lang[textseparator]:&nbsp;$dateseplist</td>
</tr>

==================================================================================
Enjoy!