×ðÁú¿­Ê±¹ÙÍøµÇ¼

Oracleʱ¼äÏÔʾ·½·¨Ð޸ļ¼ÇÉ

¡¶Oracleʱ¼äÏÔʾ·½·¨Ð޸ļ¼ÇÉ  £¬ÐèÒªÏêϸ´úÂëʾÀý¡·

ÔÚOracleÊý¾Ý¿âÖÐ  £¬Ê±¼äµÄÏÔʾÊdz£¼ûµÄ²Ù×÷ÐèÇóÖ®Ò»¡£Ä¬ÈÏÇéÐÎÏ  £¬OracleÊý¾Ý¿âÖÐʱ¼äµÄÏÔʾÃûÌÃÊÇÀο¿µÄ  £¬¿ÉÊÇÓÐʱ¼äÎÒÃÇÐèҪƾ֤×Ô¼ºµÄÐèÇó¾ÙÐÐÃûÌû¯ÏÔʾ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚOracleÊý¾Ý¿âÖÐÐÞ¸Äʱ¼äÏÔʾ·½·¨  £¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£

ÐÞ¸Äʱ¼äÏÔʾÃûÌÃ

ÔÚOracleÊý¾Ý¿âÖÐ  £¬Ê±¼ä×ֶεÄÊý¾ÝÀàÐÍͨ³£ÎªDATE»òTIMESTAMP  £¬¶øÕâÁ½ÖÖÀàÐÍÔÚĬÈÏÇéÐÎÏÂÏÔʾµÄÃûÌÃÊÇÀο¿µÄ¡£ÈôÊÇÎÒÃÇÏ£ÍûÐÞ¸Äʱ¼äµÄÏÔʾ·½·¨  £¬¿ÉÒÔͨ¹ýʹÓÃTO_CHARº¯Êý½«Ê±¼ä×Ö¶Îת»»ÎªÖ¸ÃüÃûÌõÄ×Ö·û´®¡£TO_CHARº¯ÊýµÄÓï·¨ÈçÏ£º

SELECT TO_CHAR(time_column, 'format') FROM table_name;

µÇ¼ºó¸´ÖÆ

ÆäÖÐ  £¬time_columnΪʱ¼ä×Ö¶ÎÃû  £¬formatΪʱ¼äÃûÌû¯Ä£°å¡£ÏÂÃæÊÇһЩ³£ÓõÄʱ¼äÃûÌû¯Ä£°å¼°Æä¼ÄÒ壺

YYYY-MM-DD HH24:MI:SS£ºÄê-ÔÂ-ÈÕ Ê±:·Ö:Ãë

MM/DD/YYYY HH:MI:SS AM£ºÔÂ/ÈÕ/Äê ʱ:·Ö:Ãë ÉÏÎç/ÏÂÕ½Êé

DD-MON-YYYY HH12:MI:SS AM£ºÈÕ-ÔÂ-Äê ʱ:·Ö:Ãë ÉÏÎç/ÏÂÕ½Êé

Ïêϸ´úÂëʾÀý

¼ÙÉèÓÐÒ»¸öÃûΪemployeesµÄ±í  £¬ÆäÖаüÀ¨hire_date×Ö¶ÎÌåÏÖÔ±¹¤Èëְʱ¼ä¡£ÎÒÃÇÏ£Íû½«Èëְʱ¼äÒÔ”Äê-ÔÂ-ÈÕ”µÄÃûÌÃÏÔʾ³öÀ´¡£¿ÉÒÔʹÓÃÒÔÏÂSQLÓï¾ä£º

SELECT TO_CHAR(hire_date, 'YYYY-MM-DD') AS hire_date_formatted
FROM employees;

µÇ¼ºó¸´ÖÆ

ÔËÐÐÒÔÉÏSQLÓï¾äºó  £¬hire_date×ֶν«ÒÔ”Äê-ÔÂ-ÈÕ”µÄÃûÌÃÏÔʾ³öÀ´¡£ÈôÊÇÐèÒªÏÔʾÆäËûÃûÌà  £¬Ö»ÐèÐÞ¸ÄTO_CHARº¯ÊýÖеÄÃûÌû¯Ä£°å¼´¿É¡£

³ýÁËʹÓÃTO_CHARº¯ÊýÍâ  £¬»¹¿ÉÒÔͨ¹ýÐ޸ĻỰ¼¶±ð»òϵͳ¼¶±ðµÄʱ¼äÃûÌòÎÊýÀ´ÊµÏÖʱ¼äÏÔʾ·½·¨µÄÐ޸ġ£¿ÉÒÔʹÓÃALTER SESSIONÓï¾äÐ޸ĻỰ¼¶±ðµÄʱ¼äÃûÌòÎÊý  £¬»òÕßʹÓÃALTER SYSTEMÓï¾äÐÞ¸Äϵͳ¼¶±ðµÄʱ¼äÃûÌòÎÊý¡£

×ܽ᣺ͨ¹ýÒÔÉÏÏÈÈÝ  £¬ÎÒÃÇÏàʶÁËÔõÑùÔÚOracleÊý¾Ý¿âÖÐÐÞ¸Äʱ¼äµÄÏÔʾ·½·¨  £¬Ö÷ÒªÊÇͨ¹ýʹÓÃTO_CHARº¯Êý½«Ê±¼ä×Ö¶Îת»»ÎªÖ¸ÃüÃûÌõÄ×Ö·û´®¡£Í¬Ê±  £¬ÌṩÁËÏêϸµÄ´úÂëʾÀýÀ´ÑÝʾÔõÑùʵÏÖʱ¼äÏÔʾ·½·¨µÄÐ޸ġ£Ï£ÍûÕâЩ¼¼ÇɶÔÄúÔÚOracleÊý¾Ý¿âÖд¦Àíʱ¼ä×Ö¶ÎʱÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇOracleʱ¼äÏÔʾ·½·¨Ð޸ļ¼ÇɵÄÏêϸÄÚÈÝ  £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí  £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø  £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È  £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ  £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢  £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢  £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå  £¬9:30-18:30  £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ