Logo Luan Morina
Display current date from “setlocale” settings

zondag

22 december

2024

Week 51

The setlocale() function in PHP allows you to set locale information. Locale information includes language, time, monetary, and other specifics related to a geographical area. Here's a simple example:

/* Set locale to Dutch */
setlocale(LC_ALL, 'nl_NL');

/* Output: zondag, 22 december 2024 */
echo strftime("%A %e %B %Y");

PHP (Demo)

<?php 
setlocale (LC_TIME, "nl_NL"); 
echo strftime("
<h1>%A</h1> 
<h2>%e %B</h2> 
<h3>%Y</h3>
<h4>Week %V</h4>
"); 
?>

CSS (Demo)

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500&display=swap');

.calendar-container {
margin: 0 auto;
max-width: 260px;
font-family: "Oswald", sans-serif;
} 

.calendar-container {
margin: 0 auto;
max-width: 260px;
font-family: "Oswald", sans-serif;
} 

.calendar-header {
display: flex;
flex-direction: row;
justify-content: space-around;
background-color: rgba(204, 84, 70, 0.44); 
border-top-right-radius: 10px;
border-top-left-radius: 10px;
border-bottom: 4px solid #ffffff;
}

.calendar-header span {
background-color: rgba(237, 240, 241, 0.44);
border: 4px solid rgba(255, 255, 255, 0.44); 
width: 20px;
height: 40px;
border-radius: 6px;
position: relative;
top: -20px;
}

.calendar-body {
background-color: rgba(255, 255, 255, 0.44);
min-height: 100px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
padding: 20px;
text-align: center;
text-transform: uppercase;
}

.calendar-body h1 {
font-size: .80em;
margin: 0 0 4px 0;
color: rgba(0, 0, 0, .5);
}
	
.calendar-body h2 {
font-size: 2.2em;
margin: 0 0 4px 0;
color: rgba(0, 0, 0, .9);
}
	
.calendar-body h3 {
font-size: 1.2em;
font-weight: normal;
color: rgba(0, 0, 0, .5);
}
	
.calendar-body h4 {
font-size: 0.9em;
font-weight: normal;
color: rgba(0, 0, 0, .4);
}
   Current date from the system's language settings