How to use strptime in PHP

This article describe about strptime() Function in PHP.
  • 1540

strptime() Function

strftime() generated date/time parse by strptime() function.

Note: Parsed date return by this function in the array. meaning of return array key.

  • [tm_mday] - day of the month (1-31)
  • [tm_mon] - months since January (0-11)
  • [tm_year] - years since 1900
  • [tm_sec] - seconds (0-61)
  • [tm_min] - minutes (0-59)
  • [tm_hour] - hour (0-23)
  • [tm_wday] - days since Sunday (0-6)
  • [tm_yday] - days since January 1 (0-365)
  • [unparsed] - the date part which was not identify using the specified format, if any
     

Syntax

strptime(date, format)

 

Example

 

<html>
<body>
<?php
$format= '%d/%m/%Y %H:%M:%S';
$strf1 = strftime($format);
echo "$strf1";
print_r(strptime($strf1, $format));
?>
</body>
</html>

 

Output


pic11.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.