PHP Code

How to format times and dates in Arabic with PHP

If you use localization in your web application, and you need dates & times localized to Arabic, then it's best to have a robust and reliable PHP class to do the conversion for you.

The arDate class is functionally similar to the native PHP date() function. It takes the parameters: timestamp integer value, and a date format string.

The class returns a formatted string representing the provided date encoded in Arabic, using the Windows-1256 character set. The names of the months, days of the week and AM and PM references are translated into the Arabic equivalents.

The class can also convert a data from the Gregorian calendar (represented in timestamp input) into a data Hegri Islamic calendar using same format string of the PHP date() function.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image