Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php season calculation

<?php
  $giorno = date('d');
  $mese = date('n');

  if (($mese <= 3 && $giorno < 21) || ($mese == 12 && $giorno >= 22)) {
    $stagione = "Winter";
  } elseif ($mese <= 6 && $giorno <= 20) {
    $stagione = "Spring";
  } elseif ($mese <= 9 && $giorno >= 22) {
    $stagione = "Summer";
  } else {
    $stagione = "Autumn";
  }
 
PREVIOUS NEXT
Tagged: #php #season #calculation
ADD COMMENT
Topic
Name
7+9 =