Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Change profile birthday date format

Asked Modified Viewed 3,033 times
T
tes
T
tes 10
  • Junior Member, joined since
  • Contributed 16 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
asked
Junior Member

I'd like to change the birthday date on the profile from [MM/DD/YYYY] to [DD/MM/YYYY] but I don't know what should I change...

Thanks
0 replies

9 posts

A
adicrst
A
  • Member, joined since
  • Contributed 111 posts on the community forums.
  • Started 32 threads in the forums
answered
Member

try changing the format in Admin Panel > System Admin > Time & Date
0 replies
T
tes
T
tes 10
  • Junior Member, joined since
  • Contributed 16 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
answered
Junior Member

I've tryed it too, but it doesn't work... :(

In fact, I've got fusion on spanish languaje. October (english) should be called "Octubre"(spanish) and it's shown as "oktoober" (german) (only in administration). But it's a secondary thing, before I want to change profile birthday date format.

Thanks!
0 replies
J
Joe Kriz
J
  • Senior Member, joined since
  • Contributed 281 posts on the community forums.
  • Started 39 threads in the forums
answered
Senior Member

I am assuming you are using "todays_birthday_panel" infusion. ??????

The date used in this panel that I have is hard coded meaning it is Not using the date from the admin panel.

To change the date format to what you want, find this line of code:
$heute = "____-".showdate('%m-%d',time());

and change the %m-%d to what you want.

If you are wanting to change this in the profile.php, then try changing it in the user_fields.
Edited by Joe Kriz on 13-10-2008 20:47,
0 replies
S
Sveinungs
S
  • Veteran Member, joined since
  • Contributed 935 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

No, I believe tes means the profile field.

You could swish MM and DD by editing /includes/user_fields/user_birthdate_include.php

to something like this:
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: user_birthdate_include.php
| Author: Digitanium
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

if ($profile_method == "input") {
   if (isset($user_data['user_birthdate']) && $user_data['user_birthdate'] != "0000-00-00") {
      $user_birthdate = explode("-", $user_data['user_birthdate']);
      $user_month = number_format($user_birthdate['1']);
      $user_day = number_format($user_birthdate['2']);
      $user_year = $user_birthdate['0'];
   } else {
      $user_month = 0; $user_day = 0; $user_year = 0;
   }
   echo "<tr>\n";
   echo "<td class='tbl'>".$locale['uf_birthdate'].": <span class='small2'>(dd/mm/yyyy)</span></td>\n";
   echo "<td class='tbl'><select name='user_day' class='textbox'>\n<option value=''>&nbsp;</option>\n";
   for ($i = 1; $i <= 31; $i++) { echo "<option".($user_day == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
   echo "</select>\n<select name='user_month' class='textbox'>\n<option value=''>&nbsp;</option>\n";
   for ($i = 1; $i <= 12; $i++) { echo "<option".($user_month == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
   echo "</select>\n<select name='user_year' class='textbox'>\n<option value=''>&nbsp;</option>\n";
   for ($i = date("Y"); $i > 1930; $i--) { echo "<option".($user_year == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
   echo "</select>\n</td>\n";
   echo "</tr>\n";
} elseif ($profile_method == "display") {
   if ($user_data['user_birthdate'] != "0000-00-00") {
      echo "<tr>\n";
      echo "<td width='1%' class='tbl1' style='white-space:nowrap'>".$locale['uf_birthdate']."</td>\n";
      echo "<td align='right' class='tbl1'>";
      $months = explode("|", $locale['months']);
      $user_birthdate = explode("-", $user_data['user_birthdate']);
      echo "".number_format($user_birthdate['2']).". ".$months[number_format($user_birthdate['1'])]." ".$user_birthdate['0'];
      echo "</td>\n</tr>\n";
   }
} elseif ($profile_method == "validate_insert" || $profile_method == "validate_update") {
   if ((isset($_POST['user_month']) && $_POST['user_month'] != 0) && (isset($_POST['user_day']) && $_POST['user_day'] != 0) && (isset($_POST['user_year']) && $_POST['user_year'] != 0)) {
      $user_birthdate = (isnum($_POST['user_year']) ? $_POST['user_year'] : "0000")
      ."-".(isnum($_POST['user_month']) ? $_POST['user_month'] : "00")
      ."-".(isnum($_POST['user_day']) ? $_POST['user_day'] : "00");
   } else {
      $user_birthdate = "0000-00-00";
   }
   if ($profile_method == "validate_insert") {
      $db_fields .= ", user_birthdate";
      $db_values .= ", '".$user_birthdate."'";
   } elseif ($profile_method == "validate_update") {
      $db_values .= ", user_birthdate='".$user_birthdate."'";
   }
}
?>
0 replies
J
Joe Kriz
J
  • Senior Member, joined since
  • Contributed 281 posts on the community forums.
  • Started 39 threads in the forums
answered
Senior Member

Just found this line of code in the /includes/user_fields/user_birthdate_include.php
The date is hard coded and doesn't use the time/date settings from the admin panel.

   echo "<td class='tbl'>".$locale['uf_birthdate'].": <span class='small2'>(mm/dd/yyyy)</span></td>\n"


As sveinungs mentions above, just switch the mm and the dd around.

0 replies
S
SiteMaster
S
If i have touched it, it's W3C Valid
  • Senior Member, joined since
  • Contributed 305 posts on the community forums.
  • Started 15 threads in the forums
answered
Senior Member

if it is when you edit your profile use this, it is controlled via the admin panel

open /includes/user_fields/user_birthdate_include.php
find (line 29 to 38)
   echo "<tr>\n";
   echo "<td class='tbl'>".$locale['uf_birthdate'].": <span class='small2'>(mm/dd/yyyy)</span></td>\n";
   echo "<td class='tbl'><select name='user_month' class='textbox'>\n<option value=''>&nbsp;</option>\n";
   for ($i = 1; $i <= 12; $i++) { echo "<option".($user_month == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
   echo "</select>\n<select name='user_day' class='textbox'>\n<option value=''>&nbsp;</option>\n";
   for ($i = 1; $i <= 31; $i++) { echo "<option".($user_day == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
   echo "</select>\n<select name='user_year' class='textbox'>\n<option value=''>&nbsp;</option>\n";
   for ($i = date("Y"); $i > 1930; $i--) { echo "<option".($user_year == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
   echo "</select>\n</td>\n";
   echo "</tr>\n";


replace with
   // Start SiteMaster style mod
   if ($settings['shortdate'] == "%d-%m-%Y" || $settings['shortdate'] == "%d/%m/%Y" || $settings['shortdate'] == "%d.%m.%Y"){
         echo "<tr>\n";
         echo "<td class='tbl'>".$locale['uf_birthdate'].": <span class='small2'>(dd/mm/yyyy)</span></td>\n";
         echo "<td class='tbl'><select name='user_day' class='textbox'>\n<option value=''>&nbsp;</option>\n";
         for ($i = 1; $i <= 31; $i++) { echo "<option".($user_day == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
         echo "</select>\n<select name='user_month' class='textbox'>\n<option value=''>&nbsp;</option>\n";
         for ($i = 1; $i <= 12; $i++) { echo "<option".($user_month == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
         echo "</select>\n<select name='user_year' class='textbox'>\n<option value=''>&nbsp;</option>\n";
         for ($i = date("Y"); $i > 1930; $i--) { echo "<option".($user_year == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
         echo "</select>\n</td>\n";
         echo "</tr>\n";
   }else{
         echo "<tr>\n";
         echo "<td class='tbl'>".$locale['uf_birthdate'].": <span class='small2'>(mm/dd/yyyy)</span></td>\n";
         echo "<td class='tbl'><select name='user_month' class='textbox'>\n<option value=''>&nbsp;</option>\n";
         for ($i = 1; $i <= 12; $i++) { echo "<option".($user_month == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
         echo "</select>\n<select name='user_day' class='textbox'>\n<option value=''>&nbsp;</option>\n";
         for ($i = 1; $i <= 31; $i++) { echo "<option".($user_day == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
         echo "</select>\n<select name='user_year' class='textbox'>\n<option value=''>&nbsp;</option>\n";
         for ($i = date("Y"); $i > 1930; $i--) { echo "<option".($user_year == $i ? " selected='selected'" : "").">".$i."</option>\n"; }
         echo "</select>\n</td>\n";
         echo "</tr>\n";
   }
   // End SiteMaster style mod


English:
This mod will display the birthdate as set in Short date format in Admin panel -> System Admin -> Time and Date Settings

if %d-%m-%Y, %d/%m/%Y or %d.%m.%Y is selected it will show it like this 16-08-2008, 16/08/2008 or 16.08.2008
if non of the above is selected i will show the default month-day-year

if it is when you view a profile
in the same file find (lini 61)
      echo $months[number_format($user_birthdate['1'])]." ".number_format($user_birthdate['2'])." ".$user_birthdate['0'];


replace with
   // Start SiteMaster style mod
   if ($settings['shortdate'] == "%d-%m-%Y" || $settings['shortdate'] == "%d/%m/%Y" || $settings['shortdate'] == "%d.%m.%Y"){
      echo number_format($user_birthdate['2'])." ".$months[number_format($user_birthdate['1'])]." ".$user_birthdate['0'];
   }else{
      echo $months[number_format($user_birthdate['1'])]." ".number_format($user_birthdate['2'])." ".$user_birthdate['0'];
   }
   // End SiteMaster style mod


it use the same settings as the first code
Edited by SiteMaster on 13-10-2008 22:06,
0 replies
J
Joe Kriz
J
  • Senior Member, joined since
  • Contributed 281 posts on the community forums.
  • Started 39 threads in the forums
answered
Senior Member

My post above didn't work for me.

I am trying to add a comma after the day in the birthdate in the profile.php which is similar to what you are trying to do.
Right now the birthdate reads like this.
October 13 2008
I think it should have a comma for US dates.

Here is the code in the profile.php
echo "<td colspan='2' class='tbl2'><strong>".$locale['u045']."</strong></td>\n";
      [b]echo "</tr>\n".$user_fields_output[2];[/b]
      echo "</table>\n";

The part that needs changing is the $user_fields_output[2]
I cannot find where this is hiding.

Edit: haven't had time to try sitemasters yet
Edited by Joe Kriz on 13-10-2008 21:47,
0 replies
T
tes
T
tes 10
  • Junior Member, joined since
  • Contributed 16 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
answered
Junior Member

I've been reading all you've wrote. And finally I did this:

on "user_birthdate_include.php"

find
echo $months[number_format($user_birthdate['1'])]." ".number_format($user_birthdate['2'])." ".$user_birthdate['0'];


replace with
echo number_format($user_birthdate['2'])." ".$months[number_format($user_birthdate['1'])]." ".$user_birthdate['0'];


Thanks, all you for your help :)
0 replies
A
AMiR-RavaNi
A
  • Newbie, joined since
  • Contributed 1 post on the community forums.
answered
Newbie

:o
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 9 posts
  • Votes 0 votes
  • Topic users 6 members

6 participants

J
J
  • Senior Member, joined since
  • Contributed 281 posts on the community forums.
  • Started 39 threads in the forums
A
A
  • Member, joined since
  • Contributed 111 posts on the community forums.
  • Started 32 threads in the forums
S
S
  • Veteran Member, joined since
  • Contributed 935 posts on the community forums.
  • Started 3 threads in the forums
T
T
tes 10
  • Junior Member, joined since
  • Contributed 16 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
S
S
If i have touched it, it's W3C Valid
  • Senior Member, joined since
  • Contributed 305 posts on the community forums.
  • Started 15 threads in the forums
A
A
  • Newbie, joined since
  • Contributed 1 post on the community forums.

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet