Return to Snippet

Revision: 29994
at August 6, 2010 02:54 by d3developer


Initial Code
                    try {
                            queryString += ' where Start_Date_Time__c > ';
                            startDate = String.escapeSingleQuotes(startDate); //Protection against SOQL Injection
                            String[] s = startDate.split('/');
                            for (Integer i=0;i < s.size();i++) 
                               if (s[i].length()==1) 
                                  s[i] = '0' + s[i]; 
                            queryString += s[2] + '-' + s[0] + '-' + s[1] + 'T00:00:00Z';
                            whereUsed=true;
                    }
                    catch (Exception e){
                        ApexPages.Message m = new ApexPages.Message(ApexPages.Severity.WARNING, 'Start Date is in the wrong format');
                        ApexPages.addMessage(m);
                    } 

//  salesforce blog: http://www.d3developer.com

Initial URL

                                

Initial Description

                                

Initial Title
@fractastical string to SOQL DateTime 

Initial Tags

                                

Initial Language
Other