• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

someone help me with this php scripting?

Shimmishim

Elite Member
function get_date_short($date) {
$today = @gmdate('Ymd', time() + (3600 * 2));
$compare = substr($date ,0,8);

$day = substr($date, 6,2);
$month = substr($date, 4,2);
$hours = substr($date, 8,2);
$minutes = substr($date, 10,2);

if ($today == $compare) {
return "$hours:$minutes";
}

else {
return "$day/$month";
}
}

function get_date_long($date) {
$day = substr($date, 6,2);
$month = substr($date, 4,2);
$year = substr($date, 0,4);
$hours = substr($date, 8,2);
$minutes = substr($date, 10,2);

return "$day-$month-$year $hours:$minutes";
}

function get_date_archive($date) {
$month = substr($date, 4,2);
$year = substr($date, 0,4);

$month_array = array("januari", "februari", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december");
$month_text = $month_array[$month - 1];

return "$month_text $year";



this script i got is from someone from germany

so the time displayed is the time in germany and the date is displayed day-month-year

how do i fix this so that the time displays central time and the date is displayed month-day-year instead?

thanks!
 
1. These are three different functions and none call each other, what are each 3 for?
2. What is the input for each one supposed to be?
3. Using @ is bad!
4. php's date(), time(), mktime(), and a few other functions should usually provide more than enough functionality, these functions seem to duplicate them in one way or another.
 
Originally posted by: BingBongWongFooey
1. These are three different functions and none call each other, what are each 3 for?
2. What is the input for each one supposed to be?
3. Using @ is bad!
4. php's date(), time(), mktime(), and a few other functions should usually provide more than enough functionality, these functions seem to duplicate them in one way or another.

it's for adding a log entry to a webpage..

when you add an entry, the date, time, and author of who published shows up on the page

so any suggestions?
 
BingBongWongFooey, I think you've got the wrong idea, he's not trying to learn how to code PHP efficiently, he's trying to get his website working with the least possible amount of effort required.
 
Originally posted by: Shimmishim
Originally posted by: BingBongWongFooey
1. These are three different functions and none call each other, what are each 3 for?
2. What is the input for each one supposed to be?
3. Using @ is bad!
4. php's date(), time(), mktime(), and a few other functions should usually provide more than enough functionality, these functions seem to duplicate them in one way or another.

it's for adding a log entry to a webpage..

when you add an entry, the date, time, and author of who published shows up on the page

so any suggestions?

That still says nothing about what each function actually *does*.
 
Back
Top