Welcome Guest, Not a member yet? Register   Sign In
[solved] MySQL date manipulation
#2

[eluser]obiron2[/eluser]
OK, This is what I did, I hope it helps someone else

In my SELECT statement

Code:
select DATE_ADD(EndDate, INTERVAL 1 DAY) as NewDate

where EndDate is a field in the table that gets selected. If you do this you can't select * from the table, you have to specify all of the fields you want.

This will return the date in EndDate plus 1 day.


drop this in a helper file

Code:
function makeLongDateFromMySQLDate($indate)
{
  // $indate should be in the format 'YYYY-MM-DD' as per the Date format in MySQL
  $x = explode('-',$indate);
  $timestamp = mktime(0,0,0,$x[1],$x[2],$x[0]);
  $outdate=date('l jS \of F Y',$timestamp);
  return $outdate;
}

I am sure someone could make it more flexible if they need to.

This returns the date in a format

"Monday 1st of October 2007"


Messages In This Thread
[solved] MySQL date manipulation - by El Forum - 10-18-2007, 08:11 AM
[solved] MySQL date manipulation - by El Forum - 10-18-2007, 09:33 AM
[solved] MySQL date manipulation - by El Forum - 10-18-2007, 01:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB