PHP Timestamp Date Time format Function

Today, We want to share with you PHP Timestamp Date Time format Function .
In this post we will show you PHP Date and Time, hear for How to Convert PHP Timestamp to Date Format with example we will give you demo and example for implement.
In this post, we will learn about PHP Date & Time Function with an example.

PHP Timestamp Date Time format Function

There are the Following The simple About PHP Timestamp Date Time format Function Full Information With Example and source code.

As I will cover this Post with live Working example to develop PHP Timestamp, so the some major files and Directory structures for this example is following below.

  • index.php
Also Read :  How to Auto Post on Twitter using PHP API

Example of The PHP Timestamp

index.php

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.

<?php
   $student_reg_date = getdate();
   
   foreach ( $student_reg_date as $key => $val ){
      print "$key = $val<br />";
   }
	
   $timedate_format  = "Today's date: ";
   $timedate_format .= $student_reg_date['mday'] . "/";
   $timedate_format .= $student_reg_date['mon'] . "/";
   $timedate_format .= $student_reg_date['year'];
   
   print $timedate_format;
?>

Simple Print Current Timestamp using PHP

  • d – (01 to 31)display the day of the month
  • m – (01 to 12)display a month
  • Y – (in four digits)display a year
  • l (lowercase ‘L’) – display the day of the week
Also Read :  How to Open URL in New Tab using Magento

PHP time() Functions

print time()

<?php
$today_timestamp = time();
echo $today_timestamp;
?>

PHP strtotime() Functions

print strtotime()

<?php
$today_timestamp = strtotime("now");
echo $today_timestamp;
?>

PHP mktime() Functions

print mktime()

<?php
$today_timestamp_by_mktime = mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"));
echo $today_timestamp_by_mktime;
?>

PHP microtime() Functions

print microtime()

<?php
$today_timestamp_string = microtime();
echo $today_timestamp_string;
$today_timestamp_float = microtime(TRUE);
echo $today_timestamp_float;
?>

PHP date() Functions

print date()

<?php
$today_date = date("U");
echo $today_date;
?>

<!DOCTYPE html>
<html>
<body>

<?php
echo "Pakainfo Date is " . date("Y/m/d") . "<br>";
echo "Pakainfo Date is " . date("Y.m.d") . "<br>";
echo "Pakainfo Date is " . date("Y-m-d") . "<br>";
echo "Pakainfo Date is " . date("l");
?>

</body>
</html>

PHP date Output

Pakainfo Date is 2018/08/20
Pakainfo Date is 2018.08.20
Pakainfo Date is 2018-08-20
Pakainfo Date is Monday

php-timestamp Example

PHP Date with Time to Timestamp Conversion

<?php
$date_with_timestamp = date("d-m-Y",$today_timestamp);
echo "Formatted Your date With timestamp:" . $date_with_timestamp;
?>

Angular 6 CRUD Operations Application Tutorials

Read :

Also Read :  PHP nested While Loops and Multiple Conditions

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Timestamp Date Time format Function.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Recommended For You.

Laravel Advance Database Query Builder
Today, We want to share with you Laravel Advance Database Query Builder.In this post we will show you Database: Query

Add a Comment

Your email address will not be published. Required fields are marked *