Date value format

Hello,

I need help with date format. I am reading a date from sql using php and then I want to format this date to show the month name instead of month number.
Also I need this when I enter the date in an Input type=“date”.

My code is:

$sql = 'SELECT * FROM table'; 
$stmt = $connection->prepare($sql);
$stmt -> execute([]);
$projects = $stmt -> fetchAll ();

foreach ($projects as $project){
echo $project->projectDate; where projectDate is a date type field in SQL
}

I want this echo to convert the date and show the month. It is a confusion because you never know what the month is.

Also, I have an input type=date on a form and I want to get it’s value from a php code and write it on the screen. Also, how can I get the month name from this input.

Thank you.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

thx. Can anybody help me with my question?

There are two factors to consider here.

No.1
It’s the weekend. So activity on the forum might be a little bit slower than on weekdays.

No.2
Since you are asking about PHP it is just of matter of someone on the forum that is comfortable with php that can assist you.

I would just be patient just for those two reasons mentioned earlier.

Good luck!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.