Forum Discussion

didonato's avatar
didonato
Creator II
8 years ago

Edit Effective_Date

I'm trying to edit "Effective_Date", but get an error " The specified value for property Effective Date '01/17/2018 01:17:58 PM' of MIN_Delivered_Component does not match the required format. String today_str = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt"); Item DeliveredComponent = this.newItem("MIN_Delivered_Component","edit"); DeliveredComponent.setID(fullBOM.getItemByIndex(i).getRelatedItemID()); DeliveredComponent.setProperty("effective_date",today_str); DeliveredComponent = DeliveredComponent.apply();

2 Replies

  • Hi Didonato, If you set the date string like this: string today_str = String.Format("{0:s}", DateTime.Now); It will work. See www.csharp-examples.net/.../ for a good selection of examples of C# date handling. The actual "sortable" format that is stored in the database is "2018-01-18T16:49:57" or "yyyy-mm-ddThh:mm:ss" but it's easier to use the String.Format code. Hope this helps. Brian.