You need to sign in to do that
Don't have an account?
shiv@SFDC
Conver ISO format to salesforce date format
Hi,
I am calling an API and in respose it returns me JSON data. In this i am abstracting a field value which is in ISO format : 2013-12-14T09:49:25-05:00
I need to store this value on an SFDC Object record. please let me know the formating for this.
I am doing this (DateTime.valueOf(responseMap.get('last_reported_at'))).format('YYYY-MM-DDThh:mm:ss-hh:mm') .
Let me know ulternate for this. It will be good if we can do using DateTime format method of salesforce.
I am getting this error : Invalid date/time: 2014-08-25T15:18:41.938Z
I am calling an API and in respose it returns me JSON data. In this i am abstracting a field value which is in ISO format : 2013-12-14T09:49:25-05:00
I need to store this value on an SFDC Object record. please let me know the formating for this.
I am doing this (DateTime.valueOf(responseMap.get('last_reported_at'))).format('YYYY-MM-DDThh:mm:ss-hh:mm') .
Let me know ulternate for this. It will be good if we can do using DateTime format method of salesforce.
I am getting this error : Invalid date/time: 2014-08-25T15:18:41.938Z
Note, the format is different than what you're stating in your post above.
You could also try using the parse method, which takes a different format:
All the info you could ever want on the Datetime object is here: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm
Hi shiv@SFDC,
You can easily get year/month/day/hour/min (using methods d.year() / d.month() .....) from ISO format and then use to create a DateTime.newInstance method to create a DateTime object and store it in sobject field.
Adding a sample code for reference. Choose this as best answer if it resolves your query or ask anything if needed.
Shubham Nandwana.
AppPerfect Corp.
salesforce@appperfect.com
408-252-4100
http://www.appperfect.com/services/salesforce/
Salesforce Development & Operations Experts
iso certification (https://ias-malaysia.com)