Jump to content

get_date_time | Select only day, month and year.


soltek

Recommended Posts

Hey there

The following code prints the number of posts added on the last 24 hours and I wanted to make it so it prints the posts whoose ADDED value in the database is equal to the current day, month and year.

 

Here's the code:

$date_time = get_date_time(gmtime()-(3600*24)); // the 24hrs
$todaypos = number_format(get_row_count("posts", "WHERE posts.added>='$date_time'"));

echo "<br>Today's posts:<B> " . $todaypos . "</b>";

 

If you could give me a hand, it'd be awesome,

Thank you.

Just remove the day.

$date = date('Ym');
$todaypos = number_format(get_row_count("posts", "WHERE DATE_FORMAT(posts.added, '%Y%m') = '$date'"));

 

Yes, read  and try and come up with something on your own:-*

Archived

This topic is now archived and is closed to further replies.

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