Hi, all!
i am use the xml-rpc service in my the java application. I am do update/insert of the nod. I am use the node.save method. All fields has been changed/inserted. But the value of the timstamp field not changed. After update/insert the timestamp field is empty. I do not get the error. I am not understand - why? How i can solved it problem?
Code on java:
java.util.Date date = new java.util.Date(fieldValue[i]);
valueMap.put("value", (date.getTime()/1000));
} catch(Exception ex){
valueMap.put("value", (Long.valueOf(timestamp)));
}
valueMap = new HashMap();
valueMap.put("timezone", "America/New_York");
valueMap.put("timezone_db", "UTC");
valueMap.put("date_type", "datestamp");
valueArray[0] = valueMap;
newNode.put(fieldName[i], valueArray);
Thanks!
By rusbob on
Comments
Thanks! I solved problem.
Thanks! I solved problem.
post solution perhaps
It's useful to post solutions to problems you've had so that others can benefit.
Cheers,
Joe
Joe
any chance you're gonna share
any chance you're gonna share your solution with us?
Solving
My solving:
Map valueMap = new HashMap();
Map datatimeMap = new HashMap();
GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance();
try {
gc.setTime(df.parse(fieldValue[i]));
} catch (Exception ex) {
}
datatimeMap.put("date", gc.get(Calendar.MONTH)+"/"
+gc.get(Calendar.DATE)+"/"+ gc.get(Calendar.YEAR));
datatimeMap.put("time", gc.get(Calendar.HOUR)+":"
+gc.get(Calendar.MINUTE)+":"+ gc.get(Calendar.SECOND));
valueMap.put("value",datatimeMap);
Object[] valueArray = {valueMap};
newNode.put(fieldName[i], valueArray);
Work fine!
Solving in PHP
I was looking the solution for the same problem. Here is my solution in PHP. The 'value' of $field_date[0] must correspond to the widget type and the input format. In my case I used the widget "Text Field with custom input format" and the input format "Y-m-d H:i:s".
Same problem with node.save.. I can't fix it in no way
rusbob you say work fine, but I think there are some fields you have not mentioned, like :
fieldValue[i]
df --> what's df? gc.setTime(df.parse(fieldValue[i]));
I'm doing that... :
and I always get the same two errors..
I think it depends your drupal site configuration, no?