String date = '';
String time = '';
How to concatenate the two strings to StartDatetime(Datetime datatype) field?
I am using two strings date and time seperately ,If i fill date & time then i want to combine the two fields and store in one field (i.e) Startdatetime__c
(Datatype as DateTime) how to fix this one?
This is my REST request { "sdate" : "2/12/2013", "stime" : "12:05:00" }
. How do I convert the sdate
& stime
into a DateTime
field StartDatetime__c
?
Best Answer
Here's an example from some code I used in a trigger on how to do this
So, in your case,
note the blank space between the
'
and thehh
. You need this separation. SF will automatically add:00
seconds for you so there's no need to add them unless you actually are recording seconds or microseconds for that matter.If properly formatted as above, you could then do the following: