欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Oracle查询星期几

程序员文章站 2022-05-06 22:44:20
...
  • SQL语句查询给定时间是星期几;
  • 查询函数TO_CHAR (datetime)
SELECT SYSDATE FROM dual;

SELECT to_char(SYSDATE,'DAY') FROM dual;

SELECT to_char(SYSDATE,'DAY','NLS_DATE_LANGUAGE=''SIMPLIFIED CHINESE''') FROM dual;

SELECT to_char(SYSDATE,'DAY','NLS_DATE_LANGUAGE=AMERICAN') FROM dual;

SELECT to_char(SYSDATE,'DY','NLS_DATE_LANGUAGE=AMERICAN') FROM dual;

 

2013/8/27 14:27:05

星期二

星期二

TUESDAY  

TUE

 

  •  TO_CHAR语法
TO_CHAR({ datetime | interval } [, fmt [, 'nlsparam' ] ])

 

 

  • to_char_date::=
    Oracle查询星期几
            
    
    博客分类: Oracle to_charnlsOracle星期NLS_DATE_LANGUAGE
     
  • fmt:日期格式
Element

Description

D

Day of week (1-7). This element depends on the NLS territory of the session.

DAY

Name of day.

DY

Abbreviated name of day.

 

  • nlsparam:
'NLS_DATE_LANGUAGE = language'

 

  • 附:

Oracle Database Supported Languages

 Language Name

 Language Abbreviation

 Default Sort

ALBANIAN

sq

GENERIC_M

AMERICAN

us

binary

ARABIC

ar

ARABIC

ASSAMESE

as

binary

AZERBAIJANI

az

AZERBAIJANI

BANGLA

bn

binary

BELARUSIAN

be

RUSSIAN

BRAZILIAN PORTUGUESE

ptb

WEST_EUROPEAN

BULGARIAN

bg

BULGARIAN

CANADIAN FRENCH

frc

CANADIAN FRENCH

CATALAN

ca

CATALAN

CROATIAN

hr

CROATIAN

CYRILLIC KAZAKH

ckk

GENERIC_M

CYRILLIC SERBIAN

csr

GENERIC_M

CYRILLIC UZBEK

cuz

GENERIC_M

CZECH

cs

CZECH

DANISH

dk

DANISH

DUTCH

nl

DUTCH

EGYPTIAN

eg

ARABIC

ENGLISH

gb

binary

ESTONIAN

et

ESTONIAN

FINNISH

sf

FINNISH

FRENCH

f

FRENCH

GERMAN DIN

din

GERMAN

GERMAN

d

GERMAN

GREEK

el

GREEK

GUJARATI

gu

binary

HEBREW

iw

HEBREW

HINDI

hi

binary

HUNGARIAN

hu

HUNGARIAN

ICELANDIC

is

ICELANDIC

INDONESIAN

in

INDONESIAN

IRISH

ga

binary

ITALIAN

i

WEST_EUROPEAN

JAPANESE

ja

binary

KANNADA

kn

binary

KOREAN

ko

binary

LATIN AMERICAN SPANISH

esa

SPANISH

LATIN SERBIAN

lsr

binary

LATIN UZBEK

luz

GENERIC_M

LATVIAN

lv

LATVIAN

LITHUANIAN

lt

LITHUANIAN

MACEDONIAN

mk

binary

MALAY

ms

MALAY

MALAYALAM

ml

binary

MARATHI

mr

binary

MEXICAN SPANISH

esm

WEST_EUROPEAN

NORWEGIAN

n

NORWEGIAN

ORIYA

or

binary

POLISH

pl

POLISH

PORTUGUESE

pt

WEST_EUROPEAN

PUNJABI

pa

binary

ROMANIAN

ro

ROMANIAN

RUSSIAN

ru

RUSSIAN

SIMPLIFIED CHINESE

zhs

binary

SLOVAK

sk

SLOVAK

SLOVENIAN

sl

SLOVENIAN

SPANISH

e

SPANISH

SWEDISH

s

SWEDISH

TAMIL

ta

binary

TELUGU

te

binary

THAI

th

THAI_DICTIONARY

TRADITIONAL CHINESE

zht

binary

TURKISH

tr

TURKISH

UKRAINIAN

uk

UKRAINIAN

VIETNAMESE

vn

VIETNAMESE

  • Oracle查询星期几
            
    
    博客分类: Oracle to_charnlsOracle星期NLS_DATE_LANGUAGE
  • 大小: 3.7 KB