1
MS-2001
Convert date to timestamp
  • 2004/10/23 14:27

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


is there an easy way to convert any date (for exemple: 30.10.2004 15:35) to a timestamp?

2
christian
Re:Convert date to timestamp
  • 2004/10/23 16:58

  • christian

  • Just can't stay away

  • Posts: 401

  • Since: 2002/2/24


You can test this :
Select unix_timestamp('2001-01-02 15:35')

3
MS-2001
Re:Convert date to timestamp
  • 2004/10/23 18:45

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


Well, i wrote a function because i think theres no function which can do that:

function dateToTimestamp($date$addSeconds) {
    
$tmparr explode(" "$date);
    
$datearr explode("."$tmparr[0]);
    
$timearr explode(":"$tmparr[1]);

    return 
mktime($timearr[0],$timearr[1],0,$datearr[1],$datearr[0], $datearr[2]) + $addSeconds;    
}


use it if u need it

4
Dave_L
Re:Convert date to timestamp
  • 2004/10/23 19:46

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7



Login

Who's Online

225 user(s) are online (141 user(s) are browsing Support Forums)


Members: 0


Guests: 225


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits