Jump to content


Photo

"timetostr"..?


  • Please log in to reply
2 replies to this topic

#1 jdoe

jdoe

    Newbie

  • New Members
  • Pip
  • 6 posts

Posted 07 May 2006 - 05:06 AM

While I've easily found a number of manners to convert a timestamp to a formatted date, I'm having the hardest time trying to find a way to convert a formatted date into a timestamp!

I know there's got to be a way to "timetostr" as it were, converting a, for example, date(d F Y H:i:s O) formatted date into a MySQL-style timestamp, but I've driven myself to headache and still haven't found it.

Any help, a function that'll accomplish this, would be much, much obliged!

#2 wildteen88

wildteen88

    Advanced Member

  • Staff Alumni
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 07 May 2006 - 09:52 AM

The only way to convert a string into a timestamp (UNIX) is strtotime.

MySQL supports UNIX timestamps.

#3 jdoe

jdoe

    Newbie

  • New Members
  • Pip
  • 6 posts

Posted 07 May 2006 - 04:57 PM

God! I had the whole thing backward; it is just plain ol' strtotime()! Idiot!

Thanks very much, I've got it now!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com