title: Saving academic year to MySQL database based on now() timestamp?
body: <p>I am running a university help desk office where the employees use a php form to register the queries they have answered in a MySQL database.</p>
  
  <p>Basically the form creates some values that are stored as variables in php and then saved in the database, like so:</p>
  
  <pre><code>$employeename = $_POST['employeename'];
  $medium = $_POST['medium'];
  $timespent = $_POST['timespent'];
  
  $query = "INSERT INTO queries VALUES ('',now(),'$employeename','$medium','$timespent')";
  mysqli_query($con,$query);
  </code></pre>
  
  <p>This gives me the following table structure:</p>
  
  <pre><code>id | timestamp            | employeename | medium | timespent
   1 | 2015-11-30 10:52:57  | Jennifer     | e-mail | 5
   2 | 2015-11-30 10:55:02  | Jason        | phone  | 2
  </code></pre>
  
  <p>I'd like to add a column in my MySQL database that stores the academic year where each query is saved as I will be using this grouping quite often when counting how many queries was saved.</p>
  
  <p>Our academic years are written 2013/2014, 2014/2015, 2015/2016, etc. Each academic year covers the period from 1 September to 31 August, meaning that e.g. all queries with timestamps from and including 2015-09-01 00:00:00 to but not including 2016-09-01 00:00:00 should save "2015/2016" in my academic year column in the database.</p>
  
  <p>I am looking for the PHP code I would need to interpret "now()" from my MySQL query into the correct academic year and saving it to my database, preferably in a way where I won't have to add previous/coming academic years to my code (i.e. if a user saves a query in 1 September 2020 the script would automatically know to save the academic year as 2020/2021).</p>
  
  <p>Any help would be much appreciated. I am sorry for not including any sample code. The reason is that I have no idea about how I would go about doing this and thus am unsure what to read up on.</p>