Создание сайтов, поисковое продвижение, разработка веб-приложений.
+7 (917) 43-73-926
Email: feedback@goinweb.ru
ул. Новоженова 90/1, офис 419

code-date

Иногда нужно вывести дату и не просто день, месяц, год числами, а красиво с названиями дня недели и месяца и всё это на родном языке.  Известно, что  в языке 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 г."); ?>

В выводе, можно менять последовательность (день, месяц, год) и добавит стили по вкусу.

Не дорого и в срок разработаем сайт для Вас.

Комментарии  

#601 Nancy 29.11.2023 22:50
Good day! Do you know if they make any plugins to safeguard against hackers?
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
#602 Nate 29.11.2023 23:23
Hi there! Someone in my Myspace group shared this website
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/
#603 Monroe 30.11.2023 00:29
Marvelous, what a weblog it iѕ! This weblog presents valuabⅼe data to us,
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/)
#604 Buster 30.11.2023 02:09
What's Going down i am new to this, I stumbled upon this
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/
#605 Freeman 30.11.2023 03:04
Hello! I'm at work browsing your blog from my new iphone 4!
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/
#606 Lela 30.11.2023 03:13
Hi there eхⅽellent bloց! Doees running a blog similar to this requirе a large
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/
#607 Oren 30.11.2023 04:24
I am really impressed with your writing skills and also with the
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/)
#608 Archie 30.11.2023 06:35
I am nnot sure wƅere you are getting your info, but good topic.

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,
#609 Anja 30.11.2023 17:56
Good way of describing, and pleasant article to
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/
#610 Dianne 30.11.2023 20:36
I'd like to thank you for the efforts you've put in writing
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/
#611 Nathan 30.11.2023 21:17
What's uρ everуone, it's my first pay a ѵisit at this web page,
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/
#612 Ouida 01.12.2023 03:22
Spot on with this write-up, I seriously believe this website needs a lot more
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/

Добавить комментарий

Защитный код
Обновить

Бесплатная консультация

Вам нужен сайт, но вы не знаете с чего начать? Оставьте ваши имя и телефон, мы перезвоним и бесплатно проконсультируем Вас.

Бесплатная консультация по телефону:

+7 917 4373926
Ежедневно c 10:00ч до 20:00ч.

 

Услуги | Портфолио | Блог | РБ
Перепечатка информации с сайта www.goinweb.ru, возможна только с указанием активной гиперссылки.
Веб-студия «GOINWEB»: Разработка, продвижение, обслуживание и поддержка веб-сайтов. E-mail:feedback@goinweb.ru
Яндекс.Метрика