Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Cadastro\Hydrator\Strategy;
- use Zend\Stdlib\Hydrator\Strategy\DefaultStrategy;
- class DateTimeStrategy extends DefaultStrategy
- {
- /**
- * Converte uma string para um objeto de DateTime
- *
- * @return \DateTime
- */
- public function hydrate($value)
- {
- if (is_string($value)) {
- $value = new \DateTime($value);
- }
- return $value->format('d/m/Y');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment