/ Published in: PHP
                    
                                        
That snippet return the name of the day (in Italian, but you can easily change that). Giving a value to $offset permits to refer to a day that isn't today, and setting $short to True permits to return a three character shorthand.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function giorni_ita( $short=false, $offset=0 ){
$week = ( 1 => 'Lunedì', 2 => 'Martedì', 3 => 'Mercoledì',
4 => 'Giovedì', 5 => 'Venerdì', 6 => 'Sabato', 7 => 'Domenica' );
$weekshort = ( 1 => 'Lun', 2 => 'Mar', 3 => 'Mer', 4 => 'Gio', 5 => 'Ven', 6 => 'Sab', 7 => 'Dom' );
return $short ? $weekshort[$day] : $week[$day];
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                