Clarification regarding Oracle SQL date-syntax(fm )?

I'm studying SQL and I see this notation to display the date :

SELECT last_name, TO_CHAR(hire_date, 'fmDD Month YYYY') AS HIREDATE FROM employees

What is the meaning of the prefix of fm ? thanks


The fm prefix specifies that you don't want to get leading characters (see docs). By default, the to_char function will produce a fixed width string (this goes back to when Oracle was created and people wanted to generate text based reports that would be sent to a printer with a fixed width font so it was useful for everything to have the same number of characters).

For example, the format mask Month spells out the month. By default, that will be space padded out to the length of the longest month name (September in English so 9 characters). The fm prefix gets rid of those spaces. It also gets rid of the leading 0 on the day if it's prior to the 10th of the month. If you were generating a text report to a printer, this would be painful because your columns don't line up any more. In modern tools, it just removes annoying extraneous characters.

Need Your Help

jquery click to play video

javascript jquery html jquery-mobile

I've got a dynamically built html table from the server. Ultimately it gives me a table that looks like: