Иногда нужно вывести дату и не просто день, месяц, год числами, а красиво с названиями дня недели и месяца и всё это на родном языке. Известно, что в языке PHP есть функция “date”, которая возвращает дату. Но естественно только на английском. Выглядит это примерно так: Thursday, 28 October 2010 г.
Выглядит как-то не очень.
Хотелось бы примерно так: Четверг, 28 Октября 2010 г.
Решение очень простое:
<?php
function russian_date() {
$translation = array(
"am" => "дп",
"pm" => "пп",
"AM" => "ДП",
"PM" => "ПП",
"Monday" => "Понедельник",
"Mon" => "Пн",
"Tuesday" => "Вторник",
"Tue" => "Вт",
"Wednesday" => "Среда",
"Wed" => "Ср",
"Thursday" => "Четверг",
"Thu" => "Чт",
"Friday" => "Пятница",
"Fri" => "Пт",
"Saturday" => "Суббота",
"Sat" => "Сб",
"Sunday" => "Воскресенье",
"Sun" => "Вс",
"January" => "Января",
"Jan" => "Янв",
"February" => "Февраля",
"Feb" => "Фев",
"March" => "Марта",
"Mar" => "Мар",
"April" => "Апреля",
"Apr" => "Апр",
"May" => "Мая",
"May" => "Мая",
"June" => "Июня",
"Jun" => "Июн",
"July" => "Июля",
"Jul" => "Июл",
"August" => "Августа",
"Aug" => "Авг",
"September" => "Сентября",
"Sep" => "Сен",
"October" => "Октября",
"Oct" => "Окт",
"November" => "Ноября",
"Nov" => "Ноя",
"December" => "Декабря",
"Dec" => "Дек",
"st" => "ое",
"nd" => "ое",
"rd" => "е",
"th" => "ое",
);
if (func_num_args() > 1) {
$timestamp = func_get_arg(1);
return strtr(date(func_get_arg(0), $timestamp), $translation);
} else {
return strtr(date(func_get_arg(0)), $translation);
};
}
?>
Теперь выводим где нужно:
<?php echo russian_date("l, j F Y г."); ?>
В выводе, можно менять последовательность (день, месяц, год) и добавит стили по вкусу.
Не дорого и в срок разработаем сайт для Вас.
Бесплатная консультация по телефону:
Комментарии
I'm kinda paranoid about losing everything I've worked hard on. Any tips?
My web page Captcha Resolver: https://eythar.org/blog/index.php?entryid=101086
with us so I came to look it over. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers!
Great blog and wonderful design.
my website Captcha Breaker: https://luxuriousrentz.com/what-have-you-any-idea-about-internet-marketing/
keep it up.
Here is my Ьlog ... http://decaptcher.org/ (Helaіne: https://www.kbkrealtors.com/the-best-way-to-effectively-advertise-your-video-clips-on-the-web/)
I have discovered It positively useful and it has
helped me out loads. I am hoping to contribute & assist different customers like its aided me.
Good job.
my web page captcha solver service: https://www.amazonarticle.com/search-engine-marketing-methods-for-exceptional-website-marketing/
Just wanted to say I love reading your blog and look
forward to all your posts! Keep up the great work!
Feel free to surf to my web site Captcha solver Ocr: https://skynetsolutions.co.in/convert-oneself-into-an-skilled-on-search-engine-optimisation-by-wanting-over-this/
amount of work? I havе virtuaⅼly no қnoᴡlеdge of proցramming but I had
been hoping to start my own blog soon. Anyways, should you
have aany ideas ⲟr tips for new blօg owners please share.
I now this is off topic but Ӏ simpⅼy needed to ask.
Thanks a lot!
Here is my bⅼog: decaptchа: http://www.cleaningservicess.com/get-to-your-prospective-by-using-these-home-business-suggestions/
layout on your weblog. Is this a paid theme or did you modify it yourself?
Anyway keep up the nice quality writing, it's rare to see a great blog like
this one today.
Feel free to surf to my site ... captchadealer.c om (Abdul: https://theawakeningdigest.com/groups/secrets-to-achieving-remarkable-seo-accomplishment/members/all-members/)
I needs to sρend some time leаrning much more or understɑnding more.
Thanks for fantastic information I was looking for this info for
my mission.
Here is myy web blog: http://decaptcher.org/; Shelby: https://lnx.argonband.it/web/modules.php?name=Forums&file=profile&mode=viewprofile&u=87270,
take information about my presentation subject, which i am going to present in school.
My blog post :: decaptcha Service: https://currentnewstv.in/2023/10/30/helping-you-far-better-understand-how-to-earn-money-online-with-these-simple-to-comply-with-suggestions/
this blog. I really hope to check out the same high-grade blog posts
from you later on as well. In fact, your creative writing abilities has encouraged me to get my own site now ;)
Have a look at my site ... captcha
bypass: http://www.cleaningservicess.com/are-you-presently-a-search-engine-optimisation-rookie-we-are-able-to-support/
and piece of writing is actually fruitful in support of me,
keeр up posting such content.
Herre is my blog post capture solver: https://king.az/user/ModestaKorth8/
attention. I'll probably be back again to read more, thanks for the
info!
Here is my homepage: bypass recaptcha: https://gloriouspropertyinnovations.com/search-engine-optimisation-how-you-can-make-yahoo-and-google-be-right-for-you/