Jump to content

PHP date format


reazik

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?
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.