How can I send 'n cck date field the current date and time? I'm using rules to do a action of populate another field (end date), how can I sent the end date field the current date and time? please help.

Comments

vm’s picture

with rules I don't know but I use
now which pulls the the date/time of now

WorldFallz’s picture

iirc you can do this with php in rules: http://us.php.net/manual/en/function.strtotime.php

DickSwart’s picture

Yes but how do I pass it code? I dont know what it should look like? cant find any examples of how to format the code?
Advanced: Specify the fields value with PHP code

return array(
  0 => array('uid' => value for uid),
  // You'll usually want to stop here. Provide more values
  // if you want your 'default value' to be multi-valued:
  1 => array('uid' => value for uid),
  2 => ...
);
DickSwart’s picture

Dont understand what they want?

WorldFallz’s picture

Try this:

return array(
0 => array('value' => strtotime("now")),
);

Just a guess though.

DickSwart’s picture

Just like that thanx, if i want to do something with %node.created to I also have to use strtotime(%node.created).
Say for example work out the duration.

WorldFallz’s picture

datetime math is a little tricky-- however, afaik, the value you would use for create date would be $node->created or the [node:date] token (if you use the token module). I have no idea what '%node.created' is.