[thelist] Converting date format with PHP

Michael Pemberton mpember at phreaker.net
Fri Sep 21 00:55:27 CDT 2001


I haven't done much work with with MySQL dates, but I think the
following process should work.

The data being recieved from the user is a string.

You can either:

	break it using a series of substr() calls

		or

	Use the strtotime() method to convert is into a PHP timestamp and then
	format this back into the required structure using the date() function.
	eg.  $today = date("Y/m/d"); // for example: 10/03/2001

Eduardo Bacchi Kienetz wrote:
> 
> Howdy y'all
> 
> Well, going straight to the point:  I have a date that is typed by the user
> in the format dd/mm/yyyy, that is the user's birthdate (Brazilian date
> format). So my birthday date would be 31/03/1982 . The problem is that
> MySQL saves dates in the yyyy/mm/dd format, so I need to convert the birth
> date to MySQL's format.
> Does anybody have a function?
> 
> Thank you in advance,
> 
> Eduardo Bacchi Kienetz
> Webmaster www.camobi.com (hobby :)
> Development/Support Dept. of ICONEWEB
> www.iconeweb.com.br (the company I work for)
> 
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !

-- 
Michael Pemberton
mpember at phreaker.net
ICQ: 12107010






More information about the thelist mailing list