Jump to content

HELP PHP "PRINT" DATE QUESTION


chevys

Recommended Posts

I have a question regarding a Print Fuction I have posted the code below.

 

print("<tr>"); 

                print("<td height=\"20\"class=\"row1\"align=\"left\">$PAYP[0]</td>");

  print("<td height=\"20\"class=\"row1\"align=\"left\">$user[1]</td>");

print("<td height=\"20\"class=\"row1\"align=\"left\">$credits</td>");

print("<td height=\"20\"class=\"row1\"align=\"left\">$PAYP[2]</td>");

  print("</tr>");

 

The line that consist of $PAYP[0] returns the date when the user made a purchase but it is in this format - 1239333028 - I need it to display in the format for example 4/11/09 can anyone help?

 

Thanks

 

 

Link to comment
Share on other sites

Dont laugh lol

 

I tried date($PAYP[0])

 

I tried <?=date('F j, Y', $PAYP[0])?>

 

I just cant figure it out I scrolled down that page you suggested and I cannot figure out which one will compare to what I am tring to do.

 

Thanks

Link to comment
Share on other sites

Ok, look at this line

 

print("<td height=\"20\"class=\"row1\"align=\"left\">$PAYP[0]</td>");

as you probably know it prints the content of $PAYP[0] which is a timestamp

 

if you want to print a formatted date instead, you need to convert this timestamp first

 

for example:

 

$dateFormatted = date("Y/m/d",$PAYP[0]);
print("<td height=\"20\"class=\"row1\"align=\"left\">$dateFormatted</td>");

 

or you can do this in one step

 

print("<td height=\"20\"class=\"row1\"align=\"left\">".date("Y/m/d",$PAYP[0])."</td>");

notice, that I had to use . before and after date(). This dot tells PHP to join (the proper term is concatenate ... I still need a spellchecker for this) the strings on both side of it.

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.