How to leave the date in this format 27-Feb-17 at 21:52

2

fast thing I need to know how to leave the date in this format 27-Feb-17 at 21:52 my code is this <?php echo date('d/m/Y H:i', $news['published']); ?>

    
asked by anonymous 14.05.2017 / 20:00

1 answer

3

The documentation has exactly what you want , which is M (for the month to be in the format of Jan to Dec ) and y (for year be in two-number format, where 2017 is 17 ).

So, just change to the format for:

echo date('d-M-y \a\s H:i', $news['published']);

Try this here.

  • d is the day with 0 on the left ( 01 , 10 , 30 ).
  • The M is the month in short text ( Jan , Feb , Dec ).
  • The y is the year with only two digits ( 00 , 01 17 ).
  • The H is the time in the 24-hour format with zero left ( 00 , 01 , 23 ).
  • The i is the minutes with zero left ( 00 , 01 , 59 ).

  • The - and : are just normal texts.
  • The \a\s is to escape the text as , if it does not use the \ the a would be "changed" by am and pm and s would be "changed" "by the seconds.
14.05.2017 / 20:37