![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 14 Pomógł: 0 Dołączył: 28.12.2008 Ostrzeżenie: (0%) ![]() ![]() |
Witajcie!
Mam dwa problemy z funkcją odpowiedzialną za wyświetlanie daty dodania posta na Forum. Pierwsza z nich polega na tym, że jeżeli na przykład napisze posta o 19:20 o godzinie 03:00 następnego dnia wyświetlany jest napis "dzisiaj o 19:20". Dopiero o godzinie 19:20 zmienia się to na "wczoraj o 19:20". Czyli, krótko mówiąc dzień dodania posta zmienia się po 24 godzinach od jego dodania. Innym problem, jest to, że mam dwunastogodzinny datę, co na polskiej stronie jest trochę irytujące. A oto funkcja odpowiedzialna za wyświetlanie daty postów na forum: Kod function timePassed($time, $showtime = 1) {
global $locale, $settings; $mode = "short"; $timepassed = (time () - $time); if ($timepassed > 7 * 24 * 3600) { if($timepassed > 14 * 24 * 3600){ $timesince = showdate ( "%d-%m-%Y", $time ); } else { $timesince = floor ( $timepassed / (7 * 24 * 3600) ); $timesince .= ($timesince != "1" ? $locale ['fb980'] : $locale ['fb981']); } } elseif ($timepassed >= 24 * 3600 && $timepassed <= 48 * 3600 && $mode == "short"){ $timesince = $locale['fb2_101']; } elseif ($timepassed <= 24 * 3600 && $mode == "short"){ $timesince = $locale['fb2_100']; } elseif ($timepassed > 2 * 24 * 3600 && $mode == "short"){ $timesince = floor ( $timepassed / (24 * 3600) ); $timesince .= ($timesince != "1" ? $locale ['fb982'] : $locale ['fb983']); } elseif ($timepassed > 24 * 3600 && $mode !== "short") { $timesince = floor ( $timepassed / (24 * 3600) ); $timesince .= ($timesince != "1" ? $locale ['fb982'] : $locale ['fb983']); } elseif ($timepassed > 3600 && $mode !== "short") { $timesince = floor ( $timepassed / 3600 ); $timesince .= ($timesince != "1" ? $locale ['fb984'] : $locale ['fb985']); } elseif ($timepassed > 0 && $mode !== "short") { $timesince = floor ( $timepassed / 60 ); $timesince .= ($timesince != "1" ? $locale ['fb986'] : $locale ['fb987']); } else { $timesince = showdate ( "%d-%m-%Y", $time ); } if ($showtime || $mode == "short") $timesince .= " <span class='tbl2'>" . strftime ( "%I:%M %p", ($time + ($settings ['timeoffset'] * 3600)) ) . "</span>"; return $timesince; } |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 781 Pomógł: 256 Dołączył: 29.06.2008 Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 14.08.2025 - 10:12 |