I am trying to format a date for excel output as a date and not a string.
I am using embedded SQL...
'to_Date(sm.dep)' works properly but I want to format it differently. If I use 'to_Date(sm.dep, 'mm/dd/yyyy')' I get the error in the subject title.
Does anyone have any insight on this? Thanks.This message has been edited. Last edited by: FP Mod Chuck,
Could you provide a little more detail?
Is it a SQL Passthrough?
What is the db you are connecting to (different databases have slightly different SQL syntax ie: SQL Server, Oracle, Postgress, etc.)?
Have you done a SQL trace?
Can you provide the procedure code?
Consider this: This query shows the same date, but with the format specified.
SELECT TO_DATE('10-25-2019', 'MM-DD-YYYY') AS date_test FROM DUAL;
The data, 10-25-2019, can be a field.
You're trying to make the database format a text according to a date-format specification that does not match that text.
Dates don't have a "format", it's just a big number. What you see in clients is an interpretation of a date converted to text, usually formatted according to your localization settings or explicitly converted to text using a specific format.
If you want a formatted date, then you must convert it to text using to_char(a_date, format_specification), or you must set your client's localization according to the desired format so that the client handles the conversion appropriately.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
|Powered by Social Strata|