Find end of some day in unix timestamp format


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* $_SESSION['plusDate'] is input in "-1" style*/
  2. $_SESSION['plusDate'] = datumObj::toUnix(
  3. datumObj::fromUnix( strtotime($_SESSION['plusDays']." days") ) ,
  4. '23:59:59'
  5. );
  6.  
  7. /* based on this class */
  8. class datumObj
  9. {
  10. public static function toUnix($datum , $uur)
  11. {
  12. list($d, $m, $y) = sscanf($datum, "%d/%d/%d");
  13. return strtotime("$m/$d/$y $uur");
  14. }
  15.  
  16. public static function fromUnix( $timestamp ){
  17. return date('d/m/Y',$timestamp);
  18. }
  19. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.