Jump to content

Archived

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

reazik

PHP date format

Recommended Posts

Hi all.

I'm new (no kidding; I'm posting in the newbie section!) :)

I'm adapting a job bulletin script for my company, and I'm trying to create a column that shows when the job listing was last updated. There was already a job_date column built into the MySQL code, so I used that in my page; however, it comes through as a string of numbers, and I have no idea how to fix it.

Here's the code blurb:

<table width="90%">
<tr valign="top" {ALTERNANCE}>
<td width="30" class="style1"><a href="details.php?id={JOB_ID}" class="style2">{JOB_NAME_TITLE}</a></td>
<td width="60" align="center" class="style1">{JOB_STATE}</td>
<td width="300" class="style1">{JOB_SUMMARY}</td>
[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<td width="110" colspan="2" class="style1">{JOB_DATE}[!--colorc--][/span][!--/colorc--]
</td>
</tr>
</table>

and [a href=\"http://www.psninc.net/forms/JobBulletin/list.php\" target=\"_blank\"]Here's[/a] the result. Is there anything I can do to convert it? Is this even a PHP function?

Share this post


Link to post
Share on other sites
You can format the the date in the query using MySQL's DATE_FORMAT() function or you can do it in PHP using the date() function. eg

[code]$formatted_date = date('j M Y', $dbdate);[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=358055:date=Mar 24 2006, 04:10 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Mar 24 2006, 04:10 PM) [snapback]358055[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You can format the the date in the query using MySQL's DATE_FORMAT() function or you can do it in PHP using the date() function. eg

[code]$formatted_date = date('j M Y', $dbdate);[/code]
[/quote]

Where do I need to put this code? I've tried various ways, but I keep getting text instead of reformatting the date. I really appreciate your help.

I had already tried to do it through MySQL, but it just blanked out the dates and gave me 0000-00-00.

Share this post


Link to post
Share on other sites

×

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.