search
HomeDatabaseMysql Tutorialoracle 日期常用函?

oracle 日期常用函?

Jun 07, 2016 pm 03:12 PM
oracleCommonly useddateCommunityEnter

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 SYSDATE 2 --◎ 可得到目前系统的时间 3 4 ex. 5 select sysdate from dual; 6 7 sysdate 8 ---------- 9 20-SEP-07 10 11 常用之日期格式 12 13 日期格式 说明 14 -------------------------------

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

    SYSDATE

    2 --◎ 可得到目前系统的时间

    3

    4   ex.

    5     select sysdate from dual;

    6

    7     sysdate

    8     ----------

    9     20-SEP-07

    10

    11 常用之日期格式

    12

    13 日期格式                 说明

    14 ------------------------------------------------------------------------

    15 YYYY/MM/DD              -- 年/月/日

    16 YYYY                    -- 年(4位)

    17 YYY                     -- 年(3位)

    18 YY                      -- 年(2位)

    19 MM                      -- 月份

    20 DD                      -- 日期

    21 D                       -- 星期

    22                             -- 星期日 = 1  星期一 = 2 星期二 = 3

    23                         -- 星期三 = 4  星期四 = 5 星期五 = 6 星期六 = 7

    24

    25 DDD                     -- 一年之第几天

    26 WW                      -- 一年之第几周

    27 W                       -- 一月之第几周

    28 YYYY/MM/DD HH24:MI:SS   -- 年/月/日 时(24小时制):分:秒

    29 YYYY/MM/DD HH:MI:SS     -- 年/月/日 时(非24小时制):分:秒

    30 J                       -- Julian day,Bc 4712/01/01 为1

    31 RR/MM/DD                -- 公元2000问题

    32                -- 00-49 = 下世纪;50-99 = 本世纪

    33 ex.

    34 select to_char(sysdate,'YYYY/MM/DD') FROM DUAL;             -- 2007/09/20

    35 select to_char(sysdate,'YYYY') FROM DUAL;                   -- 2007

    36 select to_char(sysdate,'YYY') FROM DUAL;                    -- 007

    37 select to_char(sysdate,'YY') FROM DUAL;                     -- 07

    38 select to_char(sysdate,'MM') FROM DUAL;                     -- 09

    39 select to_char(sysdate,'DD') FROM DUAL;                     -- 20

    40 select to_char(sysdate,'D') FROM DUAL;                      -- 5

    41 select to_char(sysdate,'DDD') FROM DUAL;                    -- 263

    42 select to_char(sysdate,'WW') FROM DUAL;                     -- 38

    43 select to_char(sysdate,'W') FROM DUAL;                      -- 3

    44 select to_char(sysdate,'YYYY/MM/DD HH24:MI:SS') FROM DUAL;  -- 2007/09/20 15:24:13

    45 select to_char(sysdate,'YYYY/MM/DD HH:MI:SS') FROM DUAL;    -- 2007/09/20 03:25:23

    46 select to_char(sysdate,'J') FROM DUAL;                      -- 2454364

    47 select to_char(sysdate,'RR/MM/DD') FROM DUAL;               -- 07/09/20

oracle 日期常用函?

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools