I use wp_date() function to convert and show dates with hours and minutes.

wp_date( 'Y/m/d - H:m:s',1598205923, 'Asia/Tehran' )

My problem is it shows Y/m/d correct. the hour is ok. but it shows m:s with a difference of about thirty minutes!!!

1 Answer 1


Try this. It works

wp_date( 'Y/m/d - h:i:s', 1598205923, new DateTimeZone('Asia/Tehran') )

  • Can you tell me why your code works? whats the deference?
    – D.JCode
    Aug 23, 2020 at 20:47
  • 1
    Because you wrote H:m:s and 'Asia/Tehran'. I changed to these h:i:s and new DateTimeZone('Asia/Tehran')
    – Sobir
    Aug 23, 2020 at 20:50
  • I know. I get it. I thought m means minutes. but it means month. Thankyou man.
    – D.JCode
    Aug 23, 2020 at 20:55
  • I'm glad it helped
    – Sobir
    Aug 23, 2020 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.