Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php all date formats

<?php
echo date("F j, Y, g:i a")."<br>";               // March 10, 2001, 5:16 pm
echo date("m.d.y")."<br>";                       // 03.10.01
echo date("j, n, Y")."<br>";                     // 10, 3, 2001
echo date("Ymd")."<br>";                         // 20010310
echo date('h-i-s, j-m-y, it is w Day')."<br>";   // 05-16-18, 10-03-01, 1631 1618 6 Satpm01
echo date('i	 is 	he jS day.')."<br>"; // it is the 10th day.
echo date("D M j G:i:s T Y")."<br>";             // Sat Mar 10 17:16:18 MST 2001
echo date('H:m:s m is mo
	h')."<br>";   // 17:03:18 m is month
echo date("H:i:s")."<br>";                       // 17:16:18
echo date("Y-m-d H:i:s")."<br>";                 // 2001-03-10 17:16:18 (the MySQL DATETIME format)
Comment

Format and show date PHP

<?php echo date("h:i A d/m/Y", strtotime($past_event->added_date)); ?>
Comment

date formate in php

date("D M j G:i:s T Y")."<br>";             // Sat Mar 22 17:16:18 MST 2001
date('H:m:s m is mo
	h')."<br>";   // 18:03:18 m is month
date("H:i:s")."<br>";                       // 18:16:18
date("Y-m-d H:i:s")."<br>";                 // 2022-03-11 18:16:18 (MySQL DATETIME format)
date("j F, Y, g:i a")."<br>";               // 11 March, 2022, 6:16 pm
date("m.d.y")."<br>";                       // 03.11.01
date("j, n, Y")."<br>";                     // 11, 3, 2001
date("Ymd")."<br>";                         // 20010310
date('h-i-s, j-m-y, it is w Day')."<br>";   // 02-12-18, 10-03-01, 1631 1618 6 Satpm01
date('i	 is 	he jS day.')."<br>"; // it is the 15th day.
Comment

php date from format

<?php
$date = DateTime::createFromFormat('j-M-Y', '15-Feb-2009');
echo $date->format('Y-m-d');
?>
Comment

format date in php

$myDateTime = DateTime::createFromFormat('Y-m-d', $dateString);
$newDateString = $myDateTime->format('d-m-Y');
Comment

date format in php

date('m/d/Y h:i:s a',strtotime($val['EventDateTime']));
Comment

php to formate date from database

date_default_timezone_set('asia/karachi'); // set timezone
$timestamp = $row['last_login']; // get current epoch time
$format = "Y-m-d h:i:s a"; // format for date output
$formatted_date = date($format, $timestamp); // convert timestamp to format
print($formatted_date);
Comment

format a date sting php

# From a date Object:
date_format ( DateTimeInterface $object , string $format )

# From the current time
$dateTime = new DateTime(); 
// or pass a string or int ->`DateTime($date_time)`
$dateTime->format('y-j-d H:i:s T'); #print ex: 21-2-02 16:00:01 PST

# Or a quick one-liner:
date('g:i A m-d-Y', strtotime($date_time)); #print ex: 2:00 PM 02-02-2021
Comment

PREVIOUS NEXT
Code Example
Php :: name csrf token laravel mismatch 
Php :: php get last part of url 
Php :: check type in php 
Php :: php ternary operator 
Php :: publish Laravel mail pages to customize 
Php :: php json_encode 
Php :: Type error: Argument 1 passed to IlluminateAuthEloquentUserProvider::validateCredentials() 
Php :: get taxonomies for custom post type 
Php :: Target class [Controller] does not exist. 
Php :: run a server php terminal 
Php :: wordpress get the product images 
Php :: php abs() 
Php :: how to add property to an exsisting object in php 
Php :: woocommerce get variation price range 
Php :: if object or array in php 
Php :: laravel unique validation 
Php :: larave artisan command run in web 
Php :: use ternary operator as null coalescing operator in php 
Php :: column of csv to array php 
Php :: php controller 
Php :: find the highest number from array in php 
Php :: laravel-medialibrary change name of file 
Php :: create migration, controller, model and seeder laravel 
Php :: flutter network image svg 
Php :: faker laravel 
Php :: laravel group route controller 
Php :: exec command not working in php but works in terminal 
Php :: php constant array 
Php :: Laravel required if it meet some value from another field 
Php :: laravel redirect with message to section 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =