Change Birthdate format to USA mm/dd/yyyy

Michael Berry Posted in Technical Support 4 years ago

How can I change the format of the BIRTHDATE field from DD/MM/YYYY to MM/DD/YYYY ? It appears this may have been a setting on initial installation that we missed? Please advise. Thanks.

Replies
German Bob Weston Replied 4 years ago

Oh yeah.. the newsfeed.php is located in /components/Birthdays/plugins/default/birthdays/

German Bob Weston Replied 4 years ago

Thanks..

The handling of the date for the Birthday component is handled in the newsfeed.php on line 18.

the current setup is:

$time = date('jS \of F', $time);

you have to figure out how to set it up by changing jS \of F to suit your needs.
You can read about time formats in PHP here:

https://www.php.net/manual/en/function.date.php

Please remember that you are not supposed to be changing any core files because when you do an upgrade, all your work will be lost.. if you do, you need to keep good notes so you can upgrade with ease.

us Michael Berry Replied 4 years ago

Bob Weston your site looks great.

us Michael Berry Replied 4 years ago

So now the issue I have is with the FRIENDS BIRTHDAYS component. Even thought the birthdate field is now straightened out as mm/dd/yy the FRIENDS BIRTHDAYS component is still displaying it backwards for the ones it can resolve (e.g. "3rd of January" displaying when birthdate is 03/01/YYYY) and not displaying when it cannot resolve (e.g. when the birthdate field has a day > 12 and it cannot resolve it as the month.) There are only a few files in that component and I don't see the code to edit anywhere in there so I'm guessing it's calling out to another file for the function that renders 03/01/1980 as "3rd of January". That's where the fix would need to be applied.

Any help finding it is appreciated.

Thanks.

German Bob Weston Replied 4 years ago

I changed the ossn.en on mine to reflect DD/MM/YYYY

Just take a look at my main page:

https://rebellion-network.com/

us Michael Berry Replied 4 years ago

I found the last edit. In OssnProfile\plugins\default\js\OssnProfile.php line 22

dateFormat: 'mm/dd/yy',

Thanks all.

German Bob Weston Replied 4 years ago

The account.php would handle how the input is inserted into the DB and the ossn.en.php would be where you could write to let the users know the format.
For the 20 users you would have to change their birthdays manually.
I am not sure if there is a different place to have to change it because in the admin panel there is actually a calendar that drops down. I am not sure why they didn't incorporate that into the user input, it would save a lot of trouble.

us Michael Berry Replied 4 years ago

Yes I'm trying to change the BIRTHDATE field to USA format MM/DD/YYYY

German Bob Weston Replied 4 years ago

What are you trying to do?
Do you want to display the text in the field? like: Birthdate MM/DD/YYYY
If so you need to edit the files in folder locale.. ossn.en.php is the English one.