MySQL Date Functions tutorial In Hindi Aaj is article ke madhym se ham samjhege date functions ke bare me
LIST OF DATE FUNCTIONS MYSQL
- CURDATE = ये हमें आज की date return करता है =
select curdate(); - CURRENT_DATE = ये भी हमें आज की date return करता है =
select current_date(); - SYSDATE = ये हमें सिस्टम की date or time देता है =
select sysdate(); - NOW = ये आपको सर्वर की date return करता है =
select now(); - date = जब हम date और टाइम एक साथ देते है तो उसकी date हमें देता है =
select date(“2021-10-15 10:12:22”); - month– ये date का month return करता है =
select month(“2021-10-15 10:12:22”); - monthname = ये हमें महीने का नाम देता है
select monthname(“2021-10-15 10:12:22”); - QUATER = ye hame quter deta hai saal me 4 qt hote hai =
select quarter(“2021-12-20 12:12:20”); - LAST_DAY= ye mahine ki last day return karta hai ki kis mahine ki konsi date thi 30 ya 31
select LAST_DAY(“2021-12-20 12:12:20”); - DAY= ye hame day deta hai ki hame ki mahine ka konsi tarik hai
select day(“2021-12-20 12:12:20”); - DAYNAME= ye hame din return karta hai tarikh ka
- DAYOFMONTH= ye bhi hame mahine ka day hi deta hai
- DAYOFWEEK= ye hame week ka index number deta hai
- DAYOFYEAR= ye hame saal ka konsa din hai use deta hai
- WEEK= saal me jitne bhi week hai uska ye week number deta hai ki ye konsa week hai
- WEEKDAY= ye hapte ka din batata hai ki is tarik ko saal ka konsa day hai
- WEEKOFYEAR=
- YEAR= ये हमें साल return करता है select year(“2021-10-15 10:12:22”);
- YEARWEEK= ye hame saal or week number doni hi return karta hai
- EXTRACT= iska use karke aap month bhi nikal sakte hai year bhi nikal skate hai or date bhi nikal skate hai week jo aapne upar kiya hai ye sabhi is function se kar skate hai likhne ka tarika kuchh is prkar hai
select extract(month from “2021-12-20 12:12:20”);
istarh month ki jagah or bhi bahut peatameter hai aap uski list niche dekh sakte hai - DATE_ADD= YE BHI SAME HI KAAM KARTA HAI ADDDATE OR DATE_ADD BAS LIKHNE KA FARK HAI
- ADDDATE= KISI DATE KE ANDR KUCHH ADD KARNA OR DATE select ADDDATE(“2021-12-20”, INTERVAL 10 DAY);
- MAKEDATE= ISE HAM EK DATE CREATE KAR SKATE HAI ISME 2 PERAMETER PAAS KARTE HAI SAAL OR DATE
select makedate(2019,20); - DATE_SUB=
- SUBDATE= YE ADDDATE KA ULTA HAI YE DAY GHATATA HAI
select SUBDATE(“2021-12-20”, INTERVAL 10 DAY); - DATEDIFF= ISE AAP KISI DO DATE KE ANDR DIFFRANCE DEKH SAKTE HAI KI ISME KITNE DINO KA GAPE HAI ISME DO PERAMETER DETE HAI VO DONO HI DATE HOTI HAI
select DATEDIFF(“2015-12-20”, “2021-10-20”); - TO_DAYS= YE JAB SE SAN KI SHURUAAT HUI TAB SE LEKAR AAJ TAK KITNE DAY KA DIFRANCE HAI
- FROM_DAYS= YE FROM KA ULTA HI HAI
- PERIOD_DIFF=
- DATE_FORMAT= YE HAME EK DATE FORMAT ME DATE RETURN KARTA HAI JO KI CUSTUME ME HAI OR YE %D %M %Y KA KYA MATLAB HOTA HAI YE HAMNE PHP TUTORIL ME SAJHA HAI USE JROOR PADHE.
select DATE_FORMAT(“2015-12-20”, “%d-%m%-%Y”); - STR_TO_DATE= YE KISI BHI FORMAT ME DATE KO MYSQL KI FORMAT ME SAVE KARNA ISKA KAMA HAI LIKHNE KA TARIKA KUCHH IS PARKAR HAI.
select str_to_date(“July 10 2019”, “%M %d %Y”);
आप किसी table में से भी किसी user का डाटा के साथ month use कर सकते है
LIST OF PARAMETERS WITH EXTRACT FUNCTION
- MICROSECOND
- SECOND
- MINUTE
- DAY
- HOUR
- WEEK
- MONTH
- YEAR
- QUARTER
- YEAR
- SECOND_MICRODECOND
- MINUTE_MICROSECOND
- MINUTE_SECOND
- HOUR_MICROSECOND
- HOUR_SECOND
- HOUR_MINUTE
- DAY_SECOND
- DAY_MINUTE
- DAY_HOUR
- YEAR_MONTH
MySQL Date Functions tutorial In Hindi