php - How to set day of the week in Bulgarian language

177

I have to show tomorrow's day of the week in Bulgarian.
It is shown in English, how do I set it in Bulgarian?

<?php
 $now= new DateTime('now');
 $date=$now->modify('+1 day');                    

 echo $date->format('l');
          //prints Saturday          

I did this with an array of Bulgarian names of days and it works, but is there a way to do it withsetlocale or something else?

697

Answer

Solution:

Datetimeformat doesnt support locales, you have to convert to timestamp to usestrftime

Use LC_TIME insetlocale only to change the settings for time related formats

<?php
$now= new DateTime('now');
$date=$now->modify('+1 day');
setlocale(LC_TIME, 'bg');
echo strftime("%A", date_timestamp_get($date));

People are also looking for solutions to the problem: php - How to display results from form search, connected to database?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.