Jump to content

Echo date problem


Go to solution Solved by daniel28138,

Recommended Posts

Can someone please tell me what I am doing wrong with this? I'm just getting "500 Internal Server Error" without an error number or explanation or anything.

 

    echo "<tr bgcolor=\"#333333\"><td><p><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\green\"><b>{$band['Name']} - Review Posted: {date("F j, Y g:i a", strtotime($band["timestamp"]))}</b></font></tr>";

 

It works without the date part. But if i put the date outside the html table, it gives the date... but I'm wanting it to display next to the "Name" like....

It would echo

Band Name - Reviewed Posted: January, 18th 2014 at 2:30pm

 

Or

Band Name
Reviewed Posted: January, 18th 2014 at 2:30pm

 

 

Many Thanks

Link to comment
https://forums.phpfreaks.com/topic/285478-echo-date-problem/
Share on other sites

I'm curious, what do you use to code in? If you used any sort of IDE, then you would see that you have a syntax error.

Using the curly braces around php functions in a string won't work, you need to concatenate the function inside the string.

 

Refer to the fixed code below

echo "<tr bgcolor=\"#333333\"><td><p><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\green\"><b>{$band['Name']} - Review Posted: ".date("F j, Y g:i a", strtotime($band["timestamp"]))."</b></font></tr>";

That should fix your problem.

 

As for there not being an error number, 500 Internal Server Error is an error number..

 

Denno

Link to comment
https://forums.phpfreaks.com/topic/285478-echo-date-problem/#findComment-1465695
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.