Advertisement
michaelyuen

Untitled

Apr 24th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. Did you get any error? You sure $user['birthday'] is a date object? Have you tried var_dump($user['birthday']);
  2.  
  3. $user['birthday'] = date_create("2012-02-01");
  4. echo date_format($user['birthday'], 'm/j/Y');
  5.  
  6. http://sandbox.onlinephpfunctions.com/code/9148ec9749452ae81e1e5966837e7681c858a2db
  7.  
  8. Understand date object:
  9.  
  10. http://sandbox.onlinephpfunctions.com/code/bae170dcbcc50609a4f04f31586c07364ab61e59
  11.  
  12. http://php.net/manual/en/function.date-create.php
  13.  
  14. http://sandbox.onlinephpfunctions.com/code/18dc8a4262424cfddccd29cae18214a32162cafe
  15.  
  16. <?php
  17. $user['birthday'] = "2012-02-01";
  18. echo date('m/j/Y', strtotime($user['birthday']));
  19. ?>
  20.  
  21. Remove the space from links for DEMO. Facebook seems to have problem with that. This is my 7th comments
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement