PHP Plain date format


/ Published in: PHP
Save to your folder(s)

Format date from yyyy-mm-dd hh:mm:ss TO yyyymmddhhmmss


Copy this code and paste it in your HTML
  1. /**
  2.  * Formatta una data dal formato yyyy-mm-dd hh:mm:ss in yyyymmddhhmmss
  3.  */
  4. function plainDate( $d ) {
  5. $pd = explode(' ', $d);
  6. $dd = explode('-', $pd[0]);
  7. $hp = explode(':', $pd[1]);
  8. return( $dd[0].$dd[1].$dd[2].$hp[0].$hp[1].$hp[2] );
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.