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

Description:
This modification will change the input fields for the "Date Format" and "Time Format" in member'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.5 SP1

Code Designed By: FunForum

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 modification.
 - 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.
=======
==========
Find Code:
==========

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

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

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

=======================
Edit File: lang/English.lang.php
=======================
=======================
Add To End Of 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 File: editprofile.php
===================
==========
Find Code:
==========

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

===============
Add Code Below:
===============

    // Date/Time Format Mod Begin
    $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 Code:
==========

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

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

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

============================================================================================================================
=======
Step 3.
=======
=================
Edit File: member.php
=================
==========
Find Code:
==========

            if ($SETTINGS['avastatus'] == 'on') {

===============
Add Code 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 Code:
==========

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

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

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

============================================================================================================================
=======
Step 4.
=======
=================
Edit File: memcp.php
=================
==========
Find Code:
==========

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

===============
Add Code Below:
===============

        // Date/Time Format Mod Begin
        $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 Code:
==========

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

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

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

============================================================================================================================
=======
Step 5.
=======
===============================
Go To Administration Panel --> Templates
===============================
===========================
Edit Template: admintool_editprofile
===========================
==========
Find Code:
==========

<tr>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$altbg2" class="tablerow"><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>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[dateformat]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="dateformatnew" size="25" value="$member[dateformat]" /></td>
</tr>

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

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

============================================================================================================================
=======
Step 6.
=======
===============================
Go To Administration Panel --> Templates
===============================
=====================
Edit Template: member_reg
=====================
==========
Find Code:
==========

<tr>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$altbg2" class="tablerow"><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>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[dateformat]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="dateformatnew" size="25" value="$dformatorig" /></td>
</tr>

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

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

============================================================================================================================
=======
Step 7.
=======
===============================
Go To Administration Panel --> Templates
===============================
=======================
Edit Template: memcp_profile
=======================
==========
Find Code:
==========

<tr>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[texttimeformat]</td>
<td bgcolor="$altbg2" class="tablerow"><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>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[dateformat]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="dateformatnew" size="25" value="$member[dateformat]" /></td>
</tr>

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

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

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