datum-als-text-weergeven
Gesponsorde koppelingen
PHP script bestanden
Code (php)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?
function tijdtext($datum = 1, $tijd = 1, $dagnaam = 0,$dag_getal = 0, $maand_nr = 0,$jaar_getal = 0,$minuten = 0,$uur = 0){
date_default_timezone_set('Europe/Amsterdam');
if($dagnaam == 0){
$dagnaam = date("l");
}
if($dag_getal == 0){
$dag_getal = date("j");
}
if($maand_nr == 0){
$maand_nr = date("n");
}
if($jaar_getal == 0){
$jaar_getal = date("Y");
}
if($minuten == 0){
$minuten = date("i");
}
if($uur == 0){
$uur = date("G");
}
if($datum == 1){
//dagnaam(maandag tm zondag)
$dagnaam_engels = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
$dagnaam_nederlands = array("Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag");
$dagnaam2 = str_replace($dagnaam_engels, $dagnaam_nederlands, $dagnaam);
$dagnaam_nr = array("1", "2", "3", "4", "5", "6", "7");
$dagnaam3 = str_replace($dagnaam_nr, $dagnaam_nederlands, $dagnaam2);
echo $dagnaam3.' ';
//daggetal(1 tm 31)
echo $dag_getal.' ';
//maandnaam(januari tm december)
$maandnaam_nr = array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");
$maandnaam_nederlands = array("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December");
$maandnaam2 = str_replace($maandnaam_nr, $maandnaam_nederlands, $maand_nr);
echo $maandnaam2.' ';
//jaar
echo $jaar_getal;
}
if($datum == 1 && $tijd == 1){
echo ' om ';
}
if($tijd == 1){
//uren (0 tm 23)
$uur_24 = array("13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23");
$uur_12 = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
$uur2 = str_replace($uur_24, $uur_12, $uur);
//minuten(00 tm 59)
$minuten_nul = array("01", "02", "03", "04", "05", "06", "07", "08", "09");
$minuten_zonder_nul = array("1", "2", "3", "4", "5", "6", "7", "8", "9");
$minuten2 = str_replace($minuten_nul, $minuten_zonder_nul, $minuten);
$uur3 = $uur2 + "1";
//text berekenen
if($minuten2 == '0'){
echo $uur2.' uur';
}elseif($minuten2 == 15){
echo "kwart over ".$uur2;
}elseif($minuten2 < 20){
echo $minuten2." minuten over ".$uur2;
}elseif($minuten2 < 29){
$minutennormaal = array("20", "21", "22", "23", "24", "25", "26", "28", "27", "28");
$minutenvoorhalf = array("10", "9", "8", "7", "6", "5", "4", "3", "2");
$minuten3 = str_replace($minutennormaal, $minutenvoorhalf, $minuten2);
echo $minuten3.' minuten voor half '.$uur3;
}elseif($minuten2 == 29){
echo 'een minuut voor half '.$uur3;
}elseif($minuten2 == 30){
echo 'half '.$uur3;
}elseif($minuten2 == 31){
echo 'een minuut over half '.$uur3;
}elseif($minuten2 < 41){
$minutennormaal = array("32", "33", "34", "35", "36", "37", "38", "39", "40");
$minutenoverhalf = array("2", "3", "4", "5", "6", "7", "8", "9", "10");
$minuten3 = str_replace($minutennormaal, $minutenoverhalf, $minuten2);
echo $minuten3.' minuten over half '.$uur3;
}elseif($minuten2 == 45){
echo "kwart voor ".$uur3;
}elseif($minuten2 < 60){
$minutennormaal = array("41", "42", "43", "44", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59");
$minutenoverhalf = array("19", "18", "17", "16", "14", "13", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1");
$minuten3 = str_replace($minutennormaal, $minutenoverhalf, $minuten2);
echo $minuten3.' minuten voor '.$uur3; }
//dagdeel
$dagdeel = $uur;
if($dagdeel < 6){
$dagdeel2 = " 's nachts";
}elseif($dagdeel < 12){
$dagdeel2 = " 's ochtends";
}elseif($dagdeel < 18){
$dagdeel2 = " 's middags";
}elseif($dagdeel < 24){
$dagdeel2 = " 's avonds";}
echo $dagdeel2;
}
}
?>
function tijdtext($datum = 1, $tijd = 1, $dagnaam = 0,$dag_getal = 0, $maand_nr = 0,$jaar_getal = 0,$minuten = 0,$uur = 0){
date_default_timezone_set('Europe/Amsterdam');
if($dagnaam == 0){
$dagnaam = date("l");
}
if($dag_getal == 0){
$dag_getal = date("j");
}
if($maand_nr == 0){
$maand_nr = date("n");
}
if($jaar_getal == 0){
$jaar_getal = date("Y");
}
if($minuten == 0){
$minuten = date("i");
}
if($uur == 0){
$uur = date("G");
}
if($datum == 1){
//dagnaam(maandag tm zondag)
$dagnaam_engels = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
$dagnaam_nederlands = array("Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag");
$dagnaam2 = str_replace($dagnaam_engels, $dagnaam_nederlands, $dagnaam);
$dagnaam_nr = array("1", "2", "3", "4", "5", "6", "7");
$dagnaam3 = str_replace($dagnaam_nr, $dagnaam_nederlands, $dagnaam2);
echo $dagnaam3.' ';
//daggetal(1 tm 31)
echo $dag_getal.' ';
//maandnaam(januari tm december)
$maandnaam_nr = array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");
$maandnaam_nederlands = array("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December");
$maandnaam2 = str_replace($maandnaam_nr, $maandnaam_nederlands, $maand_nr);
echo $maandnaam2.' ';
//jaar
echo $jaar_getal;
}
if($datum == 1 && $tijd == 1){
echo ' om ';
}
if($tijd == 1){
//uren (0 tm 23)
$uur_24 = array("13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23");
$uur_12 = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
$uur2 = str_replace($uur_24, $uur_12, $uur);
//minuten(00 tm 59)
$minuten_nul = array("01", "02", "03", "04", "05", "06", "07", "08", "09");
$minuten_zonder_nul = array("1", "2", "3", "4", "5", "6", "7", "8", "9");
$minuten2 = str_replace($minuten_nul, $minuten_zonder_nul, $minuten);
$uur3 = $uur2 + "1";
//text berekenen
if($minuten2 == '0'){
echo $uur2.' uur';
}elseif($minuten2 == 15){
echo "kwart over ".$uur2;
}elseif($minuten2 < 20){
echo $minuten2." minuten over ".$uur2;
}elseif($minuten2 < 29){
$minutennormaal = array("20", "21", "22", "23", "24", "25", "26", "28", "27", "28");
$minutenvoorhalf = array("10", "9", "8", "7", "6", "5", "4", "3", "2");
$minuten3 = str_replace($minutennormaal, $minutenvoorhalf, $minuten2);
echo $minuten3.' minuten voor half '.$uur3;
}elseif($minuten2 == 29){
echo 'een minuut voor half '.$uur3;
}elseif($minuten2 == 30){
echo 'half '.$uur3;
}elseif($minuten2 == 31){
echo 'een minuut over half '.$uur3;
}elseif($minuten2 < 41){
$minutennormaal = array("32", "33", "34", "35", "36", "37", "38", "39", "40");
$minutenoverhalf = array("2", "3", "4", "5", "6", "7", "8", "9", "10");
$minuten3 = str_replace($minutennormaal, $minutenoverhalf, $minuten2);
echo $minuten3.' minuten over half '.$uur3;
}elseif($minuten2 == 45){
echo "kwart voor ".$uur3;
}elseif($minuten2 < 60){
$minutennormaal = array("41", "42", "43", "44", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59");
$minutenoverhalf = array("19", "18", "17", "16", "14", "13", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1");
$minuten3 = str_replace($minutennormaal, $minutenoverhalf, $minuten2);
echo $minuten3.' minuten voor '.$uur3; }
//dagdeel
$dagdeel = $uur;
if($dagdeel < 6){
$dagdeel2 = " 's nachts";
}elseif($dagdeel < 12){
$dagdeel2 = " 's ochtends";
}elseif($dagdeel < 18){
$dagdeel2 = " 's middags";
}elseif($dagdeel < 24){
$dagdeel2 = " 's avonds";}
echo $dagdeel2;
}
}
?>