Jump to content


Photo

Dates trouble


  • Please log in to reply
2 replies to this topic

#1 brittny85

brittny85
  • Members
  • PipPip
  • Member
  • 23 posts
  • LocationUtah

Posted 17 April 2006 - 10:59 AM

I'm trying to pull dates from a database and then use them like I would with the getDate() function. I would like to be able to take the dates from my MySQL database and break them into an array that would allow me to pull out the particular elements (i.e. month, day, year) and then manipulate those elements. Is there an easy way to do this? I was thinking it would probably have something to do with the mktime() or date() functions but I haven't been able to figure it out. I hope my question makes sense...

Thanks!
-Brittny

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 17 April 2006 - 11:04 AM

Do you just want to edit the way the day, month and year appears if so you can just do this:

$row['daterow'] = "2006-04-11 11:21:28";
date("d / m / Y", strtotime($row['daterow']));

This will then reformat the mysql date

#3 brittny85

brittny85
  • Members
  • PipPip
  • Member
  • 23 posts
  • LocationUtah

Posted 17 April 2006 - 11:10 AM

That's not quite what I was trying to do. I would like to take out the values for the month, year etc. and be able to use those values in my program. So that I could use it in a comparison like:
$date['mday'] == $x

Sorry if I'm not making much sense, I haven't had much sleep. :)

Thanks!
-Brittny




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users