Jump to content

Recommended Posts

 

I have a mysql table that has mutiple date fields.  I have some code that gets the date field that I'm looking for.

 

I then store that date to a variable.

$this_date = $row_getBus['feb_date'];

 

$this_date now contains 2010-02-22

 

I now want to display this as February 22, 2010.

 

I can't seem to be able to find a function that will do this.  Can anyone help me?

 

I will be greatfull for any help with this.

Link to comment
https://forums.phpfreaks.com/topic/192516-displaying-a-date/
Share on other sites

I had already tried what you suggest and I do see the date.  I'm missing somethig. Here's my code, (I'm a beginner so it is more then likely sloppy to all  you pros)

 

$bus_dates = array();

 

mysql_select_db($database_myData, $myID);

$query_getBus = "SELECT * FROM meetings WHERE type = 'Business'";

$getBus = mysql_query($query_getBus, $myID) or die(mysql_error());

$row_getBus = mysql_fetch_assoc($getBus);

// $totalRows_getBus = mysql_num_rows($getBus);

 

 

$counter = 0;

$today = date('Y-m-d');

 

$bus_dates[] = $row_getBus['jan_date'];

$bus_dates[] = $row_getBus['feb_date'];

$bus_dates[] = $row_getBus['mar_date'];

$bus_dates[] = $row_getBus['apr_date'];

$bus_dates[] = $row_getBus['may_date'];

$bus_dates[] = $row_getBus['jun_date'];

$bus_dates[] = $row_getBus['jul_date'];

$bus_dates[] = $row_getBus['aug_date'];

$bus_dates[] = $row_getBus['sep_date'];

$bus_dates[] = $row_getBus['oct_date'];

$bus_dates[] = $row_getBus['nov_date'];

$bus_dates[] = $row_getBus['dec_date'];

 

// Find the next meeting date

 

for ($counter=0; $counter <12; $counter++) {

  if ($bus_dates[$counter] >= $today) {

    echo "<BR>$bus_dates[$counter]";

    exit;

  }

}

 

$display_date = date("F d, Y", strtotime($bus_date));

echo $display_date;

Link to comment
https://forums.phpfreaks.com/topic/192516-displaying-a-date/#findComment-1014333
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.