I posted this in main forum but afraid I'm not going to get any play on it.. I don't know if it's a bug or just my bad drupal skills.
So, I have Node A. Node A has field_date. which is a date field using the text widget. Custom input format is m/y/d. Pretty simple.
Node A has a flag, and when flagged it triggers Action, Change date.
Change Date action is supposed to update field_date to today's date.
I initially tried using tokens as such.
[node:site-date-dd]/[node:site-date-mm]/[node:site-date-yy]
but when I try to save, I get the following message: Date is invalid.
If I make the value 01/01/09. It works perfectly. But I don't need a static date.. I need today's date. Fine... So tokens are not working. I do have the option for custom php.. So in that box I decide to pass the following code.
$today = date("m/d/y");
return $today
This saves okay but when the action runs field_date doesn't update. My php skills are clearly, very minimal but this has to be possible somehow. I figure I just am not passing the expected value to the date field. Any help, GREATLY appreciated.
Comments
Comment #1
Passionate_Lass commentedI'm interested for an answer for this as well since I need the date field to get todays date as well. :)
So a how to get todays date would be helpful. :)
Comment #2
tpainton commentedI found this post but it's not working for me.
http://drupal.org/node/491506
I basically have a flag triggered action. Action is custom php code..
I don't know php very well. I do know the value has to be d/m/y so I am trying to pass that to it. sigh. Maybe you can run with this?
Comment #3
tpainton commentedFINALLY!
Used the following php in the custom area of "Add value to a field" action.
Comment #4
tpainton commentedSpoke too soon. The returned date is 01/01/09. This despite the content types default value being blank. I am going to change this to a bug instead of a support request. let me know if I am wrong.
Comment #5
tpainton commentedMy God. This is one of those moments when I could wring someone's neck. 4 days, at least 50 hours on this stupid thing and I finally figured it out..
All someone had to do was tell me that the format for passing a date to a date field HAD to be in ISO. The correct code is..