Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6330925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:57:39+00:00 2026-05-24T17:57:39+00:00

For the code below, $count++ prints out rows of numbers ascending from 1 on

  • 0

For the code below, $count++ prints out rows of numbers ascending from 1 on up.

How could I replace it with monthly intervals starting with September 1, 2010 6 am eastern? (I. e. row one has September 1, 2010, row 2 has October 1, 2010, etc.?)

I would like the dates to be in a format that would allow me to compare to timestamps from MySQL

$result = mysql_query($sqlStr3);
$count = 1;  
$arr = array();
echo "<table>";
    while ($row = mysql_fetch_array($result)) { 

            echo '<tr >';
            echo '<td >'.$count++.'</td>';
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:57:40+00:00Added an answer on May 24, 2026 at 5:57 pm

    I’m a fan of the strtotime() function. It takes a readable string and converts it into a Unix timestamp, and it handles relative time really well as well.

    First, create a variable with your initial date:

    $date = strtotime("September 1, 2010");
    

    Each month in the loop is created by simply adding one month to the variable:

    $date = strtotime("+1 month", $date);
    

    You can use date() to format the timestamp to output it in your list:

    echo date("F j, Y", $date); 
    

    You can see the full range of formats here.

    Alternately, if you’re using PHP 5.3, you can take full advantage of the DateTime object (introduced in 5.2, but things like DateTime::add() didn’t exist until 5.3).

    As far as compatibility with MySQL, you can either use the MySQL function UNIX_TIMESTAMP to return a Unix timestamp from your query, or run the MySQL timestamp through strtotime() as well to convert it to a Unix timestamp.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can any one help me convert the below code to LINQ? Select Catg,Count(*) From
The code below works great. It prints out items in a MySQL database as
I have the below code which prints out the date which is 10 working
I'm trying to return a count from mysql. My code is below $number_of_options_sql =
The code below works. But if I comment out the line Dim objRequest As
The below code is to count the occurence of each character and it should
Code given below is taken from the stackoverflow.com !!! Can anyone tell me how
The code below is suppose to print out the TXT Resource Records i have
Discussing this answer I find out that the code bellow prints -1 and 1
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.