About php date format -


my current date format is

15/may/2015 

i want as

05/15/2015 

please me this. in advance.

given have sort of timestamp already, can this:

$date = date('m/d/y', $timestamp); 

if don't have timestamp, let's assume have current date stored in variable:

$original = '15/may/2015'; 

you can this:

$date = date('m/d/y', strtotime($original)); 

alternatively, can use datetime class:

$date = datetime::createfromformat('d/m/y', $original)->format('m/d/y'); // assumed 'd/m/y' current format  ^ // 'j/m/y', 'd/f/y', 'j/f/y', etc. 

for more info, check docs date, strtotime, , datetime.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -