Jump to content

[SOLVED] Date Formatting


Fearpig

Recommended Posts

Hi Guys,

I need pointing in the right direction on this one!

 

I have a table with a datetime field which is in the format "2007-06-20 00:00:00.000" using the following code I can display this nicely as dd/mm/yyyy (e.g. 20/06/2007).

 

<?php 

$Format_Start_Date = ($Start_Date != '')?date("d/m/Y",strtotime($Start_Date)):'';

?>

 

My question is this.... I now want to be able to edit these values by updating a form and I want the users to be able to enter the date in the format dd/mm/yyyy, can I edit the field so that it reads and updates as dd/mm/yyyy or alternately how would I convert the entry back to yyyy-mm-dd hh:mm:ss for the database to be updated?

 

 

Link to comment
https://forums.phpfreaks.com/topic/51801-solved-date-formatting/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.