datum-naar-dagnaam

Gesponsorde koppelingen

PHP script bestanden

  1. datum-naar-dagnaam

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php
function date_to_day ($date, $inputformat) {
    ########################################################
     # syntax: date_to_day($datestamp,["NL"|"INT"]) #########
     # NL: DD-MM-YYYY #######################################
     # INT: YYYY-MM-DD ######################################
     # Made for Dutch and International Datestamps only! ####
     # OUtput produces the full dutch dayname ###############
    ########################################################
    # Made by Wouter van der Burg -- February 2008 #########
    ########################################################    
    ########################################################    
    ##
    ## check if there is a timestamp in the datevar

    if (strstr($date,":")) {
        echo "<script>alert('Invalid dateformat! Only NL and US datestamps allowed, without timestamps!')</script>";
    }

    ## Split up the date in its three elements
    $date_split = explode("-",$date);
    ##
    ## Check the inputformat to set up the dayname

    if (trim($inputformat) == "NL") {
        $day = $date_split[0];
        $month = $date_split[1];
        $year = $date_split[2];
    }
elseif (trim($inputformat) == "INT") {
        $day = $date_split[2];
        $month = $date_split[1];
        $year = $date_split[0];
    }

    ## determine the dayname (0-6 , 0= sunday and 6 = saturday)
    $day = date("w",mktime(0,0,0,$month,$day,$year));
    ## Compare the output with the values in the array and return the translation
    $days[0] = "zondag";
    $days[1] = "maandag";
    $days[2] = "dinsdag";
    $days[3] = "woensdag";
    $days[4] = "donderdag";
    $days[5] = "vrijdag";
    $days[6] = "zaterdag";    
        
    return $days[$day];
        
}


echo date_to_day(date('d-m-Y'),"NL");
?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.