1

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

1

Try this. It works

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

4
  • 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, privacy policy and cookie policy

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