Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date format with all capital letters

Tags:

php

The PHP code below returns dates in this format:

July 27, 2010 7:36 pm

How could I make it return dates with capital letters? Here's what I want;

JULY 27, 2010 7:36 PM

Thanks in advance,

John

The PHP code:

format('F j, Y &\nb\sp &\nb\sp g:i a')
like image 315
John Avatar asked Dec 13 '25 07:12

John


1 Answers

The strtoupper() function converts all the characters in a string to uppercase. You can use it in the following way:

strtoupper(format('F j, Y &\nb\sp &\nb\sp g:i a'));

If you have having problems with the spaces, remember that it's  . Inserting capitals there might not work either. You could try the following:

strtoupper(format('F j, Y'))."  ".strtoupper(format('g:i a'));
like image 114
Sam152 Avatar answered Dec 16 '25 21:12

Sam152



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!