¿Eres nuevo? ¡Lee el FAQ y ponte al día!
548 visitas

How to set timestamps in fixtures with symfony and Doctrine

This is how you set timestamps in a fixtures file to use with symfony and Doctrine:

Text
  1. // You need to use single quotes if you set a date by hand
  2. example_date:  '2010-02-24 17:17:23'
  3.  
  4. // Or, you can use the date function if you need to convert a date from an UNIX timestamp
  5. example_date:  '<?php echo date('Y-m-d H:i:s', time() + rand(60, 172800)) ?>'
  6.  

­

Etiquetas: Plain Text symfony date/time Doctrine

Insertar: