Answers for "php gmdate to day hour"

PHP
1

gmdate in php

<?php
// PHP program to illustrate gmdate function
// display date Jun 25 2018 23:21:50
echo gmdate("M d Y H:i:s", mktime(23, 21, 50, 6, 25, 2018)) ."\n";

// display date  World Wide Web Consortium
// 2018-06-25T23:21:50+00:00
echo gmdate(DATE_W3C, mktime(23, 21, 50, 6, 25, 2018)). "\n";

// display date as ISO-8601 format
echo gmdate(DATE_ISO8601, mktime(23, 21, 50, 6, 25, 2018)). "\n";
?>
Posted by: Guest on December-16-2021
0

php get date from day of year

// This should get you a DateTime object from the date and year.
function getDateFromDay($dayOfYear, $year) {
  $date = DateTime::createFromFormat('z Y', strval($dayOfYear) . ' ' . strval($year));
  return $date;
}

// This should get you the day of the year and the year in a string.
date('z Y', strtotime('21 oct 2012'));
Posted by: Guest on November-10-2021

Browse Popular Code Answers by Language