In SQL Server there are a number of native style formats available, and the closest I have found to SFDC uses ISO8601 format yyyy-mm-ddThh:mm:ss.
CONVERT(varchar,o.CloseDate,126) AS CloseDate_ISO8601Format
Because I use text-based csv files to pass information up to the Salesforce cloud, I don't have to worry too much about data types, so in this case the simplest method for formatting this date is to concatenate the ISO8601 text with an appended 'Z'.
CONVERT(varchar,o.CloseDate,126)+'Z' AS CloseDate_SFDC
See also my earlier blog about conversion options for dates, and this one about date fields.
For more information on date formats and date literals, see the developer documentation.
No comments:
Post a Comment