PDA

View Full Version : Convert Date from int


asianboi
02-25-2006, 03:34 PM
Sorry if I post in the wrong forum.

I have created a new field called datetime and have this '".time()."', inserted in my sql statement. Of course it inserted as a weird # not the actual date/time. My question here is can someone show me how I can convert that into a date and time format? The output that I have is 1140887813

Thanks in advance

Marco van Herwaarden
02-26-2006, 09:19 AM
First of all you should use TIMENOW instead of time(). This will give you the same time during the whole execution of the script.

You can format dates using:
$formatted_date = vbdate($vbulletin->options['dateformat'], $mydatefield)
You can also use any of the other Date/Time formats that are defined in your vBulletin Options.

asianboi
03-04-2006, 01:41 PM
Thank you for your response, can you tell me where do I put that PHP Codes? In the template or in the page itself? If in the php page itself, is it right where the SQL statement is?