Table of Contents
Introduction
हेलो दोस्तों आज हम इस post में php function date and time function के बारेमे जानेगे!. date() and time() function का खास करते इस्तेमाल हम किसी booking system प्रकार की website creates करते है तो इस प्रकार की website development में date() and time() function का इस्तेमाल खास करके किया जाता है!.
php date() funciton in hindi
PHP में date function एक in-built function है और वह date data type बताता है!. php date and time function हमरी php script जिस server पे run होती है उस server का date and time include करता है!. php के इस function का इस्तेमाल से हम date and time अलग-अलग formate में display करा सकते है जिससे की user को date time समजने में आसानी होती है!. date and time का खास करके इस्तेमाल php SQL queries के execution के दरमियान or blog website में होता है!.
Syntax:
date(format,timestamp)
date() function मे दो parameter पास करने होते है first parameter date() function में specifies करता है की date and time किस प्रकार के formate में return और show होंगे!.
जब दूसरा parameter timestamp वह optional है अगर हम वह parameter pass नहीं करते है तो वह server का current data time provide करता है!.
Example:
<?php
$currentDate = date("d/m/y");
echo "Current Date is".$currentDate;
?>
ऊपर के example में देख सकते है की हमने date() function में format parameter pass किया है!. तो हमें जो date return होगी वह इस format में ही मिलेगी.
Format parameter explanation:
d – वह month का day represents करता है!. जिसमे day two digits के साथ होगा जैसे की (01 or 31)
Y – वह year को four-digit के साथ represents करता है जैसे की (2008 or 2022)
y – वह year को two-digit के साथ represent करता है! (08 or 22)
M – वह month का name represents करता है जैसे की (Jan to Dec)
m – वह month का numbers represents करता है जिसमे month को (01 or 12).
D – वह week के day को represents करता है जिसमे day name जैसे की (Mon to Sun)
date() function में day , month , yaer को separate करने के liye hyphens(-), dots(.), slashes(/) जैसे character के इस्तेमाल से separate कर सकते है!.
php time() funciton in hindi
ऐसी तरह से date() function में time formate को set करने के लिए
h – वह 01 to 12 मतलब की 12-hour का time zone represents करता है!.
H – वह 00 to 24 मतलब की 24-hour का time zone represents करता है!.
i – वह 00 to 59 minutes को represent करता है!.
s – वह 00 to 59 seconds को represent करता है!.
a – वह lowercase मतलब की small letter में ante meridian and post meridian को represets करता है!.
A – वह uppercase मतलब की capital letter में ante meridian and post meridian को represets करता है!.
PHP mktime() Function in hindi
php mktime() function का इस्तेमाल specific date and time, timestamp create करने के लिए इस्तेमाल किया जाता है!.
Syntax:
mktime( hour, minute, second, month, day, year )