Kmspico Download | Official KMS Activator Website [New Version 2024] Fast and Easy Converter YouTube to MP3 Online KMSAuto Net Activator Download 2024 Immediate Byte Pro Neoprofit AI Blacksprut without borders. Discover new shopping opportunities here where each link is an entrance to a world ruled by anonymity and freedom.

Date Time Functions Use in PHP

In PHP, many functions have also been created to access the current date and time so that it can show the correct time and date according to your time zone.

PHP Date & Time Function with Example, PHP Date/Time Functions, PHP 5 Date and Time Functions, How do I get the current date and time in PHP?

How to set up Time Zone?

You have to set your time zone before making date and time display in your program because every country or city has its own different time zone like in India, it is 7 o’clock in the US and maybe 12 o’clock in America, so your time zone It is necessary to set.

Set Time Zone –

date_default_timezone_set ("Asia / Kolkata"); 

In this way you can set the exact time zone of India.

How to use Date Function?

In PHP we are given a Default function – “date ()”, with the help of this function we will learn to access Date and Time –

d = It tells us the date like – 18
m = It tells us the month like – 08
y = Year like – 19
l = This Day denotes as – Thu
D = It gives the full name of the day like – Friday
M = It gives the name of the month like – June
Y = It prints the whole year like – 2019
h = It gives the information of hours like – 5
i = It gives minute information like – 30 minutes
s = It gives information about seconds like – 55 seconds
a = It gives information about am or pm

Output -> 18-08-19
Output -> 18-06-19-Thursday
Output -> 08
Output -> 18-Thu-Jun-2019
date('h : i : s a');
Output -> 05 : 27 : 23 pm
date('d-m-y-l h : i : s');
Output -> 14-06-19-Thursday 05 : 27 : 23