Posted By

neobird on 06/26/09


Tagged

year date copyright


Versions (?)

Copydate


 / Published in: PHP
 

  1. <?php
  2. /**
  3. * Copydate
  4. * Returns a year for a copyright section of a website
  5. * Return is in the format starYear-currentYear (e.g. 1999-2009)
  6. * Give the parameter for startYear, currentYear is automaticly filled
  7. * If the startYear is the same as the currentYear or higher currentYear is returned
  8. * If startYear is not a valid year, currentYear is returned
  9. *
  10. * @param string|int $starYear The year when the content was created
  11. * @return string The parsed output as described
  12. *
  13. * @copyright (c) 2009, neobird
  14. * @license http://www.opensource.org/licenses/mit-license.php MIT license
  15. *
  16. * @version 2
  17. */
  18. function copydate($startYear) { //code:neobird-copydate-2/date-copyright-year
  19. return (!ctype_digit((string)$startYear) || $startYear >= date('Y')) ? (string) date('Y') : $startYear.'-'.date('Y');
  20. }
  21. ?>

Report this snippet  

You need to login to post a comment.