Advertisement
Guest User

Thomas Antony

a guest
Jun 20th, 2009
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. include ("Date.php");
  3. class DateConvert
  4. {
  5. function LA_to_NZ($date,$time = '')
  6. {
  7. if($time != '')
  8. {
  9. $date = $date.' '.$time;
  10. }else if(is_array($date)) {
  11. $date = $date[1];
  12. }
  13.  
  14. $d = new Date($date);
  15.  
  16. $from = new Date_TimeZone('America/Los_Angeles');
  17. $d->setTZ($from);
  18.  
  19. $to = new Date_TimeZone('New Zealand Standard Time');
  20. $d->convertTZ($to);
  21. echo "<br>Using New Zealand Standard Time : ".$d->getDate()."<br>";
  22.  
  23. $d2 = new Date($date);
  24.  
  25. $from = new Date_TimeZone('America/Los_Angeles');
  26. $d2->setTZ($from);
  27.  
  28. $to = new Date_TimeZone('NZ');
  29. $d2->convertTZ($to);
  30. echo "<br>Using NZ : ".$d2->getDate()."<br>";
  31.  
  32. return $d->getDate();
  33. }
  34. }
  35. $dc = new DateConvert();
  36. $dc->LA_to_NZ('2009-06-16 23:40:51');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement