1

How do I programmatically change the value of Date's datetime field attached to an entity in Drupal 7, to the sites current time and timezone.

For example:

$entity = entity_load('node', 99);
// modify entity date
$entity->field_date_example = ...
entity_save($entity)
  • Change it when being saved or viewed? Change it every time the entity is viewed or just sometimes? – keithm Aug 7 '11 at 13:10
  • It shouldn't matter when it happens. More info added ^^ – Daniel Aug 7 '11 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.