Home php date in words PHP

date in words PHP

Author

Date

Category

Good day.

The page has 3 variables: $ dd, $ mm, $ yyyy, which are already equal to the day, month, year. I wanted to make a date output in words with variable values. I did not find anything short in the internet, more precisely, I did not find anything there. In principle, you can write code with handles, but if you transfer the numbers of the day and year in order will be very long.

Can anyone have a decision on the display of the date in words? Please share.


Answer 1, Authority 100%

Google is everything.
Here is an example for the month

function russian_date () {
$ Date = Explode (".", date ("D.M.Y"));
Switch ($ Date [1]) {
Case 1: $ M = 'January'; Break;
Case 2: $ m = 'February'; Break;
CASE 3: $ M = 'MARCH'; Break;
Case 4: $ M = 'April'; Break;
Case 5: $ M = 'May'; Break;
Case 6: $ M = 'June'; Break;
Case 7: $ M = 'July'; Break;
Case 8: $ M = 'August'; Break;
Case 9: $ M = 'September'; Break;
Case 10: $ M = 'October'; Break;
Case 11: $ M = 'November'; Break;
Case 12: $ M = 'December'; Break;
}
Echo $ date [0]. '& amp; nbsp;' $ m. '& amp; nbsp;' $ Date [2];
}
russian_date ();

Another option

& lt;? php
  // Install the Russian Local
  // or setlocale (LC_ALL, 'RU_RU'); in PHP 4.
  SetLocale (LC_ALL, 'RUS_RUS');
  // Get today's date
  // Formulate output
  //% A - short record of the day of the week (Thu)
  //% A - Normal post of week (Thursday)
  //% y - year completely (2008)
  //% y - year briefly (08)
  // shorter, watch mana
  $ Data = STRFTime ("% a,% d /% m /% y", time ());
  // In PHP4 will require conversion
  // $ data = iconv ('ISO-8859-5', 'Windows-1251', $ DATA);
  Echo $ Data; // in php 4 name of the day of the week
  // Will begin with a capital letter
  // in the usual form of recording
? & gt;

Answer 2, Authority 33%

function date_rus ($ d, $ m, $ y) {
  $ MONTHS = ARRAY (" November ',' December ');
  Return $ d. ". $ MONTHS [$ M]. ". $ y. ' of the year';
}

Answer 3

Here is an article on the topic Working with dates in MySQL. There at the end just eat how to get a date for passing, and without unnecessary problems. http://myshinobi.ru/rabota -s-datami-v-mysql /

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions