OBIEE: Casting a Date as a Character Format
How casting a date to CHAR in OBIEE works, how it differs from display formatting, and when converting a date to text helps or hurts sorting, filtering and exports.
Short answer: cast only when you need text
Convert a date to a character string in Oracle Business Intelligence (OBIEE) when a later step needs text. Examples include concatenating the date into a label, building a key, matching a fixed text format in another system, or forcing an exact layout regardless of user locale. The benefit is control: the output string is fixed. The cost is that the value stops behaving like a date. It no longer sorts chronologically unless the format is built for that, date filters and calendar prompts no longer apply, and exports carry text instead of a date type. If you only want the date to look different on screen, keep it as a date and change its display format.
What the conversion actually changes
OBIEE offers two different things that both get called formatting, and they are easy to confuse.
- Type conversion (CAST, EVALUATE, string functions): the logical SQL produces a new value of character type. Everything downstream, including sorting, filtering, aggregation and export, receives text.
- Presentation formatting (the column's Data Format settings in an analysis): the underlying value stays a date, and only how it is shown changes. Sorting, date prompts and time-based filters keep working.
Neither approach involves Unicode character substitution, mirrored glyphs or text reversal. The characters in the result are ordinary digits, letters and separators. The question is only whether those characters are stored as a string or are a rendering of a date value.
Plain CAST and its default format
The simplest form is a direct cast in a column formula:
CAST("Time"."Calendar Date" AS CHAR(10))
You do not choose the resulting layout here. It depends on the environment. The BI Server has configuration parameters for default date display, such as DATE_DISPLAY_FORMAT in NQSConfig.INI. If the cast is pushed down to the source database, that database's own conversion rules may apply instead, for example the session date format on an Oracle database. As a result, the same formula can produce different strings in different installations, or after a configuration change. No verified output for any specific version was available for this article, so test the formula in your own environment before relying on a particular layout.
Controlling the format explicitly
When the exact string matters, build it yourself. One portable approach uses OBIEE's date-part functions together with string functions, so no database-specific syntax is needed:
CAST(YEAR("Time"."Calendar Date") AS CHAR(4))
|| '-' || RIGHT('0' || CAST(MONTH("Time"."Calendar Date") AS VARCHAR(2)), 2)
|| '-' || RIGHT('0' || CAST(DAYOFMONTH("Time"."Calendar Date") AS VARCHAR(2)), 2)
Here is how this works for a date of March 4, 2026. YEAR returns 2026. MONTH returns 3, which becomes '03' after a leading zero is added and the rightmost two characters are kept. DAYOFMONTH returns 4, which becomes '04'. The result is 2026-03-04. Without the padding step, the output would be 2026-3-4, which does not sort correctly as text.
Against an Oracle database, you can also pass the database's TO_CHAR function through EVALUATE:
EVALUATE('TO_CHAR(%1, %2)' AS CHAR(10), "Time"."Calendar Date", 'YYYY-MM-DD')
EVALUATE ties the formula to one database's syntax. It may also be restricted by server configuration: later releases include a parameter, EVALUATE_SUPPORT_LEVEL, that controls whether EVALUATE is allowed. Check with your administrator whether it is permitted before choosing this route.
Display-only alternative
If the goal is just a different appearance, open the column properties in the analysis, go to the data format options, override the default and choose or enter a date pattern. The value stays a date. Sorting stays chronological, date prompts keep working, and the display can follow the user's locale settings. For most dashboard and report needs, this is the better choice.
Will the result stay usable after export or sharing?
- Sorting: text sorts character by character. A US-style string such as 03/04/2026 sorts by month before year, so 12/01/2025 appears after 03/04/2026. A zero-padded year-month-day string such as 2026-03-04 sorts in chronological order.
- Filtering and prompts: a cast column can only be filtered with text comparisons, not date ranges or relative-date logic.
- Exports: a cast value leaves OBIEE as text. Whether a spreadsheet or another tool reinterprets it as a date depends on that destination and its settings. This article has no tested results for specific destinations, so verify with a sample export.
- Copy and paste: the visible characters are ordinary text and paste as shown. Nothing hidden or substituted is introduced.
- Accessibility: screen readers read the string as written. Numeric-only formats such as 03/04/2026 are ambiguous between US and day-first conventions for both listeners and readers. Spelled-out months or the year-month-day order reduce that ambiguity. No assistive-technology testing was available for this article.
- Localization: a hard-coded string ignores user locale. That suits machine-readable outputs but is a poor fit for reports shared with readers who expect different regional formats.
When to keep the date as a date
Keep the native date type, and adjust only its display, whenever the column will be sorted, filtered, used in prompts or time-series calculations, or consumed by people in more than one region. Reserve the cast for cases where text is the actual requirement. When you do cast, prefer an explicitly built, zero-padded year-month-day string over relying on the default CAST output. Where both are needed, keep the original date column alongside the text version.
Gaps in this review
No version-specific documentation excerpts, default output samples or export tests were supplied for this article. The default format produced by a plain CAST, the availability of EVALUATE and the way specific destinations handle exported text all need to be confirmed in your own OBIEE installation.