PHP intl can convert a Gregorian date to other calendar type.
For example Gregorian to Hijri, 2017/04/11
to 1396/01/22
Or we must use external library to convert dates?
PHP intl can convert a Gregorian date to other calendar type.
For example Gregorian to Hijri, 2017/04/11
to 1396/01/22
Or we must use external library to convert dates?
PHP Already has date format functions, you need to convert first with
strtotime()
function and get the desired values withdate()
Example working here: https://eval.in/772416
You can get more info about date in php here: http://php.net/manual/en/function.date.php
Yes it can. This is an example which converts a time object to its Persian formatted string using intl:
You can find more info at php intlCalendar documentation.
You Can Use This Method:
if you call
getDateTimeFromCalendarToFormat('yyyy-MM-dd HH:mm:ss',null,'en_US')
Return
1396-06-27 13:50:21
if you call
getDateTimeFromCalendarToFormat('yyyy-MM-dd HH:mm:ss',null,'fa_IR')
Return
۱۳۹۶-۰۶-۲۷ ۱۳:۴۹:۵۱
New pattern string to use. Possible patterns are documented at Formatting Dates and Times