histats

How to set Indonesian date using PHP?

We need date format for our report, or check to customer, or something. Any legal documents need to show with date included. In my country, Indonesia, the date format have a little different with other. Format and spelling have some unique to other country. I run using PHP Framework called CodeIgniter. So, I’ll tell you how to set indonesian date format using php.

In Indonesia, basic date format you’ll find like this : Senin, 20 Januari 2017. Just for example. We need to set:

First, Day name we’ll convert to Bahasa Indonesia.

Second, We’ll convert Month name to Bahasa Indonesia,

Thirth, We just need to show up and echo the function result. Here is the complete function.

I found the function on internet. the function result show the date with day, month name in Indonesia, and also give suffix WIB (Waktu Indonesia Barat) extension.

How to use?

Easily, just call the function with parameter variable include. This function running with timestamp, date format, and suffix. If you will not use the timestamp, just keep it empty. And the date wee can improve $date_format = ‘l, j F Y as we need.

About optional format result, you can improve this code

And the end of result, look at this code

If you don’t like using suffix, just remove and anything you can do seriously.

I think enought, for any discussion we can Q&A at the comment form.

_ Sutriman