|
Re: Changing the date format on a specific field [message #666165 is a reply to message #666164] |
Wed, 18 October 2017 01:44 |
John Watson
Messages: 8938 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Welcome to the forum. Please read our OraFAQ Forum Guide and How to use [code] tags and make your code easier to read
A column of data type DATE is always stored in the same internal format, over which you have no control. You format it when you project the column in whatever way you want. For example, format SYSDATE in different ways:orclx>
orclx> select to_char(sysdate,'yyyy-mm-dd:hh24:mi:ss'),to_char(sysdate,'day month year') from dual;
TO_CHAR(SYSDATE,'YY TO_CHAR(SYSDATE,'DAYMONTHYEAR')
------------------- ------------------------------------------------------------
2017-10-18:07:41:50 wednesday october twenty seventeen
orclx>
Lastly, please don't say "field" when you mean "column".
|
|
|
Re: Changing the date format on a specific field [message #666166 is a reply to message #666165] |
Wed, 18 October 2017 03:01 |
|
Michel Cadot
Messages: 68665 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Note that the names depend on your NLS_DATE_LANGUAGE (or NLS_LANGUAGE) setting for the DAY, DY, MONTH, MON format elements but not for the YEAR format element:
SQL> select to_char(sysdate,'yyyy-mm-dd:hh24:mi:ss'),to_char(sysdate,'day month year') from dual;
TO_CHAR(SYSDATE,'YY TO_CHAR(SYSDATE,'DAYMONTHYEAR')
------------------- -------------------------------------------------------------
2017-10-18:09:50:50 mercredi octobre twenty seventeen
|
|
|
Re: Changing the date format on a specific field [message #666167 is a reply to message #666166] |
Wed, 18 October 2017 03:58 |
John Watson
Messages: 8938 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Yes. I often forget the importance of language settings, even though I remind people of them continuously. The numeric formats can cause horrific confusion:orclx> alter session set nls_territory='France';
Session altered.
orclx> select 1234/1000 from dual;
1234/1000
----------
1,234
orclx> alter session set nls_territory='United Kingdom';
Session altered.
orclx> select 1234/1000 from dual;
1234/1000
----------
1.234
orclx> So, amandasmile, we really should explicitly specify NLS for every type conversion:orclx> select to_char(sysdate,'day month year','nls_date_language=Hungarian') from dual;
TO_CHAR(SYSDATE,'DAYMONTHYEAR','NLS_DATE_LANGUAGE=HUNGARIAN')
--------------------------------------------------------------------------------------------------------------
szerda okt¾ber twenty seventeen
orclx>
|
|
|
|
|
|
|
Re: Changing the date format on a specific field [message #666183 is a reply to message #666181] |
Wed, 18 October 2017 12:05 |
|
Littlefoot
Messages: 21811 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Your response is the first response to my question
However, I still have no idea what "EDIT TABLE menu" is. I suspect that it must be some GUI tool which has several menus, one of them being the "EDIT TABLE" menu. Maybe that GUI tool also has the "Preferences" menu item which allows you to set date format which will be used while displaying date values in the grid.
But, until we're told which GUI tool it is, I really don't know what to say.
[Updated on: Wed, 18 October 2017 12:05] Report message to a moderator
|
|
|
|
|