Hi, when I try to save a custom node programmatically using the function node.create with a date field the node saves without problem but the field date remains empty.
Here is the way that I create the node:
...
XmlRpcStruct node = new XmlRpcStruct();
node["title"] = "node title";
node["type"] = "activity";
node["name"]=my_username;
XmlRpcStruct value = new XmlRpcStruct();
valor="2013-05-15 20:30";
value.Add ("value",valor);
value.Add ("timezone","Europe/Madrid");
value.Add ("timezone_db","Europe/Madrid");
value.Add ("date_type","datetime");
Object[] objValor={value};
XmlRpcStruct und=new XmlRpcStruct();
und.Add("und",objValor);
node["field_fecha3"] = und;
...
I tried with the "T" between date and time and changing the date_type to date but I get the same result.
Also have tried with Date format and Date(ISO Format) in my drupal server and a lot of differents combinations.
What I'm doing wrong? Any ideas?
Thanks.
Comments
Comment #1
tmarks commentedI had a similar issue. Turns out I had 2 problems: the first was I had the name of the field wrong, The second was I needed the full date, including seconds. I see where you set the value, you are only setting the year, month, day, hour, and minute.
I know its been a almost 2 months since you posted, but have you tried adding the seconds to your date?
Instead of "2013-05-15 20:30" use "2013-05-15 20:30:00".