home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / test_date_methods_span.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  2.8 KB  |  71 lines

  1. <?php    
  2. // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Author: Leandro Lucarella <llucax@php.net>                           |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: test_date_methods_span.php,v 1.1 2003/04/27 03:42:17 llucax Exp $
  20. //
  21.  
  22. require_once 'Date.php';
  23. require_once 'Date/Span.php';
  24.  
  25. $date = new Date();
  26. $tmp = new Date($date);
  27.  
  28. printf("Actual date: %s\n", $date->getDate(DATE_FORMAT_ISO));
  29.  
  30. $tmp->copy($date);
  31. $tmp->subtractSpan(new Date_Span('0:00:00:05'));
  32. printf("Subtracting 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  33.  
  34. $tmp->copy($date);
  35. $tmp->subtractSpan(new Date_Span('0:00:20:00'));
  36. printf("Subtracting 20 minutes: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  37.  
  38. $tmp->copy($date);
  39. $tmp->subtractSpan(new Date_Span('0:10:00:00'));
  40. printf("Subtracting 10 hours: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  41.  
  42. $tmp->copy($date);
  43. $tmp->subtractSpan(new Date_Span('3:00:00:00'));
  44. printf("Subtracting 3 days: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  45.  
  46. $tmp->copy($date);
  47. $tmp->subtractSpan(new Date_Span('3:10:20:05'));
  48. printf("Subtracting 3 days, 10 hours, 20 minutes and 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  49.  
  50. $tmp->copy($date);
  51. $tmp->addSpan(new Date_Span('0:00:00:05'));
  52. printf("Adding 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  53.  
  54. $tmp->copy($date);
  55. $tmp->addSpan(new Date_Span('0:00:20:00'));
  56. printf("Adding 20 minutes: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  57.  
  58. $tmp->copy($date);
  59. $tmp->addSpan(new Date_Span('0:10:00:00'));
  60. printf("Adding 10 hours: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  61.  
  62. $tmp->copy($date);
  63. $tmp->addSpan(new Date_Span('3:00:00:00'));
  64. printf("Adding 3 days: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  65.  
  66. $tmp->copy($date);
  67. $tmp->addSpan(new Date_Span('3:10:20:05'));
  68. printf("Adding 3 days, 10 hours, 20 minutes and 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO));
  69.  
  70. ?>
  71.