Want more features on Pastebin? Sign Up, it's FREE!
Guest

ZF-11992

By: kassner on Mar 20th, 2012  |  syntax: None  |  size: 0.89 KB  |  views: 48  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Example code:
  2.  
  3. $date1 = new Zend_Date('01/01/2012', 'dd/MM/YYYY', 'pt_BR');
  4.                
  5. var_dump($date1->toString());
  6. var_dump($date1->toString('YYYY-MM-dd'));
  7. var_dump($date1->toString('yyyy-MM-dd'));
  8.                
  9. $date2 = new Zend_Date('02/01/2012', 'dd/MM/YYYY', 'pt_BR');
  10.                
  11. var_dump($date2->toString());
  12. var_dump($date2->toString('YYYY-MM-dd'));
  13. var_dump($date2->toString('yyyy-MM-dd'));
  14.  
  15. Expected result:
  16.  
  17. // $date1
  18. string '01/01/2012 00:00:00' (length=19)
  19. string '2012-01-01' (length=10)
  20. string '2012-01-01' (length=10)
  21. // $date2
  22. string '02/01/2012 00:00:00' (length=19)
  23. string '2012-01-02' (length=10)
  24. string '2012-01-02' (length=10)
  25.  
  26. Actual result:
  27.  
  28. // $date1
  29. string '01/01/2012 00:00:00' (length=19)
  30. string '2011-01-01' (length=10)
  31. string '2012-01-01' (length=10)
  32. // $date2
  33. string '02/01/2012 00:00:00' (length=19)
  34. string '2012-01-02' (length=10)
  35. string '2012-01-02' (length=10)
clone this paste RAW Paste Data