Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Translate date("d F Y (H:i) function php

I'm brazilian and there's a wordpress plugin that uses

" . date("d F Y (H:i)",$date) . "

Output: 16 January 2013 (00:54)

But it should be 16 Janeiro 2013 (00:54), in portuguese... How can I change it?

PS: I think maybe the date is set by an external file provided by the plugin creator :p I'm not sure though

like image 294
Lucas Bustamante Avatar asked Feb 11 '13 22:02

Lucas Bustamante


People also ask

What does date () do in PHP?

The date/time functions allow you to get the date and time from the server where your PHP script runs. You can then use the date/time functions to format the date and time in several ways. Note: These functions depend on the locale settings of your server.

How convert date from yyyy-mm-dd to dd-mm-yyyy format in PHP?

Answer: Use the strtotime() Function You can first use the PHP strtotime() function to convert any textual datetime into Unix timestamp, then simply use the PHP date() function to convert this timestamp into desired date format. The following example will convert a date from yyyy-mm-dd format to dd-mm-yyyy.

How can I get current date in YMD in PHP?

date("Y/m/d") . "<br>"; echo "Today is " . date("Y.m.d") .


1 Answers

WordPress has date_i18n to retrieve the date in localized format, based on timestamp.

Try:

echo date_i18n("d F Y (H:i)", $timestamp);

WordPress has an extensive page on how to format date and time.

like image 173
RRikesh Avatar answered Sep 16 '22 15:09

RRikesh