|
|
傲视众生的麻辣香锅 · 【威朗】别克- Verano - 汽车之家· 8 月前 · |
|
|
好帅的小马驹 · APX - 雅马哈中国· 1 年前 · |
|
|
瘦瘦的烤红薯 · 著名演员寇振海:3段婚姻,三婚娶小21岁娇妻 ...· 1 年前 · |
|
|
直爽的饭盒 · [集中][单一来源]吉林省体彩长春亚泰足球俱 ...· 1 年前 · |
|
|
儒雅的单车 · 中国石油大学(华东)研究生奖助学金管理办法(修订)· 1 年前 · |
Find out a little about these methods here
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm#apex_System_Datetime_valueOf
This makes me feel a little gross, and I'm hoping another force.com expert with a little more spare brain space/experience can shed some light on this kind of parsing, but basically you may end up with something that looks like:
String year = twitterDate.substring(26, 30); String month = twitterDate.substring(4, 8); if(month.equals('Jan')) { month = '1'; } if(month.equals('Feb')) { month = '2'; } // etc. String day = twitterDate.substring(8, 11); String hour = twitterDate.substring(12, 14); String minute = twitterDate.substring(15, 17); String second = twitterDate.substring(18, 20); String finalDate = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; Datetime myDate = datetime.valueOf(finalDate);(hand crafted code, may be missing a semi colon or I might have mis-counted an index for sure)I hope twitter delivers dates in 01, 02, ... 16, 17 format, or you will get one character out, of course. If they do this, you might have to use string.split() and break your string up over whitespace, and then reference the relevant section instead for the array (you will still have to use substrings to break the time down around the colons (or another split() !!!)
Either way, hacking a string up and passing it into valueOf() is my suggestion :)
Note: the finalDate string basically needs to match "“yyyy-MM-dd HH:mm:ss" and will be considered to be delivered/set in your local time zone (so you could always adjust that with the timezone in your twitter stamp?)