Jump to content


Photo

datetime search


  • Please log in to reply
27 replies to this topic

#21 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 08 September 2006 - 03:42 PM

check out strtotime():
<?php
$ts = "2006-02-14 12:00:00";
echo date('y-m-d', strtotime($ts));
?>

You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#22 matfish

matfish
  • Members
  • PipPipPip
  • Advanced Member
  • 242 posts
  • LocationUK

Posted 08 September 2006 - 03:44 PM

Perfect once again, thank you!

#23 matfish

matfish
  • Members
  • PipPipPip
  • Advanced Member
  • 242 posts
  • LocationUK

Posted 20 September 2006 - 10:37 AM

Hi,

Dont know why I have so much trouble with dates... but - in regards to the above (using datetime) how can I -5days (or whatever) from a date from the database? It keeps bringing back weird dates etc..

Many thanks

#24 matfish

matfish
  • Members
  • PipPipPip
  • Advanced Member
  • 242 posts
  • LocationUK

Posted 20 September 2006 - 11:24 AM

Its ok, $packageexpiry = date("d-m-Y", strtotime("-5 days", strtotime($hosting['packageexpirydate']))); kinda did it


#25 coalduststar

coalduststar
  • Members
  • PipPipPip
  • Advanced Member
  • 47 posts
  • LocationNorthern Ireland

Posted 03 October 2006 - 02:20 PM

brilliant- this helped me out too! was trying to format just a TIME and DATE separately- THANKS!  ;D
There is no nobility in being superior to your fellow man- true nobility comes from being superior to your former self.

go on give us a listen!
www.jackalfeud.bandcamp.com
www.soundcloud.com/jackalfeud

#26 matfish

matfish
  • Members
  • PipPipPip
  • Advanced Member
  • 242 posts
  • LocationUK

Posted 02 November 2006 - 09:39 AM

Hi, going from one type of date format to the next:

Iv got a timestamp field ( 02-11-2006 09:35:13 ) how do you search this way just via date (not bothered about the time) so I can do searches of dates etc..?

Thanks

#27 matfish

matfish
  • Members
  • PipPipPip
  • Advanced Member
  • 242 posts
  • LocationUK

Posted 02 November 2006 - 09:41 AM

Also, wanting to list all posts in day-by-day categories - so can you distinct a date or would that only display one of each date? Thanks

#28 matfish

matfish
  • Members
  • PipPipPip
  • Advanced Member
  • 242 posts
  • LocationUK

Posted 02 November 2006 - 11:13 AM

Sorted it now anyways ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users