• Don Kelly
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I want to convert a date time like 2016-09-01 17:49:46 to 2016-09-01T17:49:46Z.

The best I can manage so far is:

$the_date = "2016-09-01 17:49:46"

date("Y-d-mTG:i:sz",$the_date)  which gives  2016-01-09UTC17:49:46244

What is the correct way to get the date time format that will work in a SOQL query ? Thanks.

 

I have trying to upsert data by using API in salesforce. and while upserting I get and " duplicate ID Exception". when passing the array.
how can fix this. i know my  array has records with same external id(duplicate). But thats why I am upserting them. how can I over come this limitation. it happens with apex to. here is for sample.

list<account> li= new list<account>();
for(integer i =0;i<50;i++){
    account acc= new account();
    acc.name='' tech corp"; 
    acc.company_email__C='example@teccorp.com'; /*this field is an external id */
    acc.updated_count__C=i;
    li.add(acc);
}
upsert li company_email__C;
This also gives the same Error.

Thanks 
Abhilash Mishra