» נושאי לימוד
» נושאי לימוד
יום שישי 26 באפריל 2024
דף 2 מתוך 6 - המשך
דף ראשי  מילון מונחים  פונקציות ואופרטורים  פונקציות זמן ותאריך  דף 2 מתוך 6 - המשך גרסה להדפסה

 (DATE_FORMAT(date,format

הטבלה הבאה מיועדת לשימוש במחרוזת format:

 

תיאור

מגדיר

(Abbreviated weekday name (sun,...,sat

a%

(Abbreviated month name (jan,...,dec

b%

(12...1) month, numeric

c%

(Day of the month with English suffix (0th, 1st, 2nd, 3rd,etc

D%

(Day of the month, numeric (0...31

d%

(Day of the month, numeric (0...31

e%

(Microseconds (000000...999999

f%

(Hour (0...23

H%

(Hour (1...12

h%

(Hour (1...12

I%

(Minutes, numeric (00...59

i%

(Day of year (001...366

j%

(Hour (0...23

k%

(Hour (1...12

I%

(Month name (January...December

M%

(12...00) month, numeric

m%

AM or PM

p%

Time, 12-hour (hh:mm:ss) followed by AM or PM

r%

(Seconds (00...59

S%

(Seconds (00...59

s%

(Time, 24-hour (hh:mm:ss

T%

Week (00...53), where Sunday is the first day of the week

U%

Week (00...53), where Monday is the first day of the week

u%

Week (01...53), where Sunday is the first day of the week; used with %x

V%

Week (01...53), where Monday is the first day of the week; used with %x

v%

(Weekday name (Sunday...Saturday

W%

(6=Day of the week (Sunday=0..Saturday

w%

Year for the week where Sunday is the first day of the week, numeric, 4digits; used with %v 

X%

Year for the week, where Monday is the first day of the week, numeric, 4digits; used with %v

x%

Year, numeric, 4 digits

Y%

Year, numeric, 2 digits

y%

'%' A literal

%%

 

 

mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',

'%W %M %Y');

        -> 'Saturday October 1997'

mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',

'%H:%i:%s');

        -> '22:23:00'

mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',

         '%D %y %a %d %m %b %j');

        -> '4th 97 Sat 04 10 Oct 277'

mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',

       '%H %k %I %r %T %S %w');

        -> '22 22 10 10:23:00 PM 22:23:00 00 6'

mysql> SELECT DATE_FORMAT('1999-01-01', '%X %V');

        -> '1998 52'

 

(DAY(date

הפונקציה ()DAY זהה לפונקציה ()DAYMONTH .

 

(DAYNAME(date

מחזיר את שם היום בשבוע מהתאריך date.

 

 

mysql> SELECT DAYNAME('1998-02-05');

        -> 'Thursday'

 

 

(DATEMONTH(date

מחזיר את היום בחודש מהתאריך date, בטווח שבין 1 ל-31.

 

 

mysql> SELECT DAYOFMONTH('1998-02-03');

        -> 3

 

 

(DAYOFWEEK(date

מחזיר את האינדקס של היום בשבוע מהתאריך date בתור הפלט: Sunday=1 Monday=2,...Saturday=7

 

 

mysql> SELECT DAYOFWEEK('1998-02-03');

        -> 3

 

 

(DAYOFYEAR(date

מחזיר את היום בשנה מהתאריך date, בטווח שבין 1 ל-366.

 

 

mysql> SELECT DAYOFYEAR('1998-02-03');

        -> 34

 

 

 04-04-04 / 22:43  עודכן ,  16-03-04 / 09:45  נוצר ע"י אלי אלוני בתאריך 
 פונקציות זמן ותאריך - הקודםהבא - דף 3 מתוך 6 - המשך 
תגובות הקוראים    תגובות  -  0
דרכונט
מהי מערכת הדרכונט?
אינך מחובר, להתחברות:
דוא"ל
ססמא
נושאי לימוד
חיפוש  |  לא פועל
משלנו  |  לא פועל
גולשים מקוונים: 5