I run a website where I periodically post articles. I'd like to add a timestamp/datestamp to each article showing the post date (the upload date, I assume, would be the logical choice). I had already asked for advice on this topic; unfortunately, the result is a blank. Literally. Here's an example: http://theapplenewsreel.com/Example.php
After the title and subtitle, there's some small (<h6>) text, which should be followed by the PHP code which displays a timestamp. I'm new to PHP, so I may be doing something wrong. Any advice?

what code are you using to display the timestamp?

Line 96. <h6>Posted on <?php date("Y-m-d H:i:s") ?></h6>. I just noticed that my browser's "Show Source" doesn't display that particular PHP snippet; just <h6>Posted on </h6>.

I just noticed that my browser's "Show Source" doesn't display that particular PHP snippet; just <h6>Posted on </h6>.

No, PHP code will never be displayed in a browser source view, as it is compiled on the server into pure HTML.

<?php date("Y-m-d H:i:s") ?>

This is calling the date function, but not outputing anything. To print it to the page use echo

<?php echo date("Y-m-d H:i:s") ?>

However, also note that this function by default returns the current date. If you want to have an actual posted date you will likely need to store a date/timestamp in the database table with the post itself. Then read it from the database and print it using the function.

<?php echo date("Y-m-d H:i:s",$posteddate) ?>

Alright, I'm trying to set up a testing server in Dreamweaver. Should I add a "Recordset (Query)"? (Please bear with me, I'm very new to PHP).

oooh... sorry, haven't used Dreamweaver in years. Does the recordset query generate some php code to fetch records from the database?? If it does, post the code it creates here - I can help with the code, but not with DW.

assuming the DB is designed with a colum for the submitted date/time
When submitting the upload to th db populate it with the sql keyword 'now'
when executing the query populate the date-time with the returned value of that column

commented: unclear response, inacurate, incorrect and incomplete information -1

Alright, I've created a table called "dates" in a database linked to my site via Dreamweaver. How, exactly, do I add an SQL keyword (either Dreamweaver or phpMyAdmin)?

now is not a keyword, it's a function. You would normally use it when you create a new record.

INSERT INTO dates (date_field) VALUES (NOW())

to execute this in PHP code you call mysql_query

mysql_query("INSERT INTO dates (date_field) VALUES (NOW())");

On its own, however, the date stored may not have much value. In the context of your post, you would normally add a date field to your post table and save the date when the post content is saved. Have you got as far as creating a table for your posts yet? because this is probably a more logical place to start.

Hello please I need a php code for

Future image


Date and time


Please help me to tag d4 code together