“PHP Date” Réponses codées

PHP Date

date_default_timezone_set('UTC'); // set timezone
$timestamp = time(); // get current epoch time
$format = "Y-m-d h:i:sa"; // format for date output
$formatted_date = date($format,$timestamp)); // convert timestamp to format
echo($formatted_date);
Tim Mackenzie

PHP Date

<?php
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set('UTC');


// Prints something like: Monday
echo date("l");

// Prints something like: Monday 8th of August 2005 03:12:46 PM
echo date('l jS \of F Y h:i:s A');

// Prints: July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));

/* use the constants in the format parameter */
// prints something like: Wed, 25 Sep 2013 15:28:57 -0700
echo date(DATE_RFC2822);

// prints something like: 2000-07-01T00:00:00+00:00
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>
The Red-est of Firebreaks

PHP Date

echo date("jS M Y",strtotime("2010-04-15 23:59:59"));
Horrible Hamerkop

PHP Date

date('M j, Y, g:ia ',strtotime($date));
Smiling Sardine

PHP Date

<?php
  $date = date('d/m/Y'); //brazilian pattern
  echo $date;
Chris

PHP Date

<?php
// set the default timezone to use.
date_default_timezone_set('UTC');


// Prints something like: Monday
echo date("l");

// Prints something like: Monday 8th of August 2005 03:12:46 PM
echo date('l jS \of F Y h:i:s A');

// Prints: July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));

/* use the constants in the format parameter */
// prints something like: Wed, 25 Sep 2013 15:28:57 -0700
echo date(DATE_RFC2822);

// prints something like: 2000-07-01T00:00:00+00:00
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>
Awaz Nipi

PHP Date

date("d"); //Day of month: 09
date("j"); //Day of month without 0: 9
date("jS"): //Day of month with "th": 21th
date("D"): //Day of week abbreviated: Thu
date("l"): //Day of week: Thursday
date("z"); //Day of the year: 110
date("t"); //Number of days in given month: 30
date("m"); //Month number: 04
date("n"); //Month number without 0: 4
date("M"); //Month name abbreviated: Apr
date("F"); //Month name: April
date("Y"); //Year: 2022
date("y"); //Last 2 digits of year: 22
date("o"); //ISO Year number: 2022
date("h"); //Hour (12 fomrat): 02
date("H"); //Hour (24 fomrat): 14
date("g"); //Hour without 0 (12 fomrat): 2
date("G"); //Hour without 0 (24 fomrat): 14
date("i"); //Minutes: 29
date("s"); //Seconds: 24
date("u"); //Microseconds: 33
date("a"); //am or pm
date("A"); //AM or PM
date("e"); //Timezone identifier: UTC
Armandres

PHP Date

<?php
$test1='2010-04-19 18:31:27';
echo date('d/m/Y',strtotime($test1));
?>
Saranya Sasi

Réponses similaires à “PHP Date”

Questions similaires à “PHP Date”

Plus de réponses similaires à “PHP Date” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code