Jump to content


Photo

Date Format


  • Please log in to reply
5 replies to this topic

#1 rscott7706

rscott7706
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationLakeside CA

Posted 02 June 2006 - 02:32 AM

In the code below. can Date Record Entered: [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]$ts[!--colorc--][/span][!--/colorc--] be date formatted?

//get data - eg, reading fields 0 and 1

$id=$myrow[0];
$cpny=$myrow[3];
$cont=$myrow[1];
$ti=$myrow[2];
$ph=$myrow[4];
$em=$myrow[5];
$opn=$myrow[6];
$desc=$myrow[7];
$req=$myrow[8];
$mn=$myrow[9];
$mx=$myrow[10];
$nd=$myrow[11];
$ts=$myrow[12];

print "</tr>\n<tr>\n";

// output row from database
echo "<td>
Date Record Entered: $ts<br><br>
Opening ID#: $id <br>
Company: $cpny <br>
Contact: $cont <br>
Title: $ti <br>
Phone: $ph <br>
E-mail: <a href=mailto:$em>$em </a> <br>
Opening: $opn <br>
Description: $desc <br>
Requirements: $req <br>
Min $: $mn <br>
Max $: $mx <br>
Need Date: $nd <br>


#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 June 2006 - 02:41 AM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]... can Date Record Entered: $ts be date formatted?[/quote]
Yes - assuming it exists in the database in a known, constant, rational format, i.e. not at the whim of whoever entered a 'date'.

There's a ton of alternatives for date formatting, detailed near the top of the page in the manual - [a href=\"http://ca.php.net/manual/en/function.date.php\" target=\"_blank\"]http://ca.php.net/manual/en/function.date.php[/a]
Legend has it that reading the manual never killed anyone.
My site

#3 rscott7706

rscott7706
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationLakeside CA

Posted 02 June 2006 - 02:53 AM

Here is my feeble attept. maybe someone can help this real newbie...

This (or other variations crash. If i just use the formatting text, it just shows as text in the resulting page.

Date Record Entered: ($ts = date("F j, Y, g:i a")<br><br>


#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 June 2006 - 02:56 AM

Assuming the format in the database is fixed, what is it?
Legend has it that reading the manual never killed anyone.
My site

#5 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 02 June 2006 - 03:04 AM

Try to change:
($ts = date("F j, Y, g:i a")
to
(" . date("F j, Y, g:i a", $ts) . ")

~ D Kuang

#6 rscott7706

rscott7706
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationLakeside CA

Posted 02 June 2006 - 03:19 AM

Andy, it's timestamp


poirot, it worked great!! Thanks my friend....





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users