Hoe doe ik dat php de antal seconden bijvoorbeeld "5341423 verandert in "8wks 5days 19hrs 43mins 43secs""
Ik moet dat hebben in mijn php scriptje
Ik moet dat hebben in mijn php scriptje
Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz
Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| function duration($tijd) { $weeks = $tijd/604800; $weeks = floor($weeks); $aantalsec = $weeks * 604800; $tijd = $tijd - $aantalsec; if ($weeks == "0") { $weeks = ""; } elseif ($weeks == "1") { $weeks = "1 wk"; } else { $weeks = "$weeks wks"; } $days = $tijd/86400; $days = floor($days); $aantalsec = $days * 86400; $tijd = $tijd - $aantalsec; if ($days == "0") { $days = ""; } elseif ($days == "1") { $days = "1 day"; } else { $days = "$days days"; } $hrs = $tijd/3600; $hrs = floor($hrs); $aantalsec = $hrs * 3600; $tijd = $tijd - $aantalsec; if ($hrs == "0") { $hrs = ""; } elseif ($hrs == "1") { $hrs = "1 hr"; } else { $hrs = "$hrs hrs"; } $min = $tijd/60; $min = floor($min); $aantalsec = $min * 60; $tijd = $tijd - $aantalsec; if ($min == "0") { $min = ""; } elseif ($min == "1") { $min = "1 min"; } else { $min = "$min mins"; } if ($tijd == "0") { $tijd = ""; } elseif ($tijd == "1") { $tijd = "1 sec"; } else { $tijd = "$tijd secs"; } return "$weeks $hrs $hrs $min $tijd"; } ?> |
1
2
3
4
| $a = 5; // $a is integer echo $a / 2; // 2 echo $a % 2; // 1 |
Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz
Date() is toch de functie die het aantal 'vanaf' de epoch doet?Op donderdag 04 oktober 2001 11:38 schreef drm het volgende:
*zucht*
Lees jij wel alle replies
1
2
3
4
| $a = 5; // $a is integer echo $a / 2; // 2 echo $a % 2; // 1 |
Klopt...ACM:
Date() is toch de functie die het aantal 'vanaf' de epoch doet?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| <? $timeSteps = array ( "s" => 1, "m" => 60, "h" => 60*60, "d" => 60*60*24, "w" => 60*60*24*7, "y" => 60*60*24*7*365 ); $timeValues = array ( "s" => 0, "m" => 0, "h" => 0, "d" => 0, "w" => 0, "y" => 0 ); foreach ( array_keys ( $timeSteps ) as $step ) { $timeValues [ $step ] = $time / $timeSteps [ $step ]; $time %= $timeSteps [ $step ]; // of $time -= $timeValues [ $step ]; // ;) @ ACM if ( $time == 0 ) break; } // en printen of returnen ofzo die zooi ?> |
Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz
Apple iPhone 16e LG OLED evo G5 Google Pixel 10 Samsung Galaxy S25 Star Wars: Outlaws Nintendo Switch 2 Apple AirPods Pro (2e generatie) Sony PlayStation 5 Pro
Tweakers is onderdeel van
DPG Media B.V.
Alle rechten voorbehouden - Auteursrecht © 1998 - 2025
•
Hosting door TrueFullstaq