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 –

<?php 
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

<?php
date('d-m-y');
Output -> 18-08-19
date('d-m-y-l');
Output -> 18-06-19-Thursday
date('m');
Output -> 08
date('d-D-M-Y');
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
?>
Cialis (Tadalafil) är den främsta konkurrenten till Viagra (Sildenafil) på marknaden för erektil dysfunktion. köpa Cialis i Sverige föredras av många på grund av sin längre varaktighet och anses vara det mest kostnadseffektiva varumärkesbaserade ED-läkemedlet som finns tillgängligt i Sverige. Cialis finns i två varianter: Cialis och Cialis Daily, och fyra olika doseringar: 2,5 mg, 5 mg, 10 mg och 20 mg, erbjuder Cialis också en rad olika alternativ för att passa patientens behov.