• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

[PHP] Unix Timestamp

ducktape

NLC
NLC
I forgot how to insert a unix timestamp into a db. I know how to insert it but i forgot how to generate it. i used something like

PHP:
$stamp = date (now());

but it doesnt work right. I know i am not doing it right. I cant find the snippet from one of my old sites i used and forgot how. But I need to insert the timestamp from the unix epoch.
 
time() -> create unix timestamp (integer) from current time
mktime(args,..,args[n]) -> create unix timestamp from arguments
date(format, timestamp) -> create date in certain format from timestamp
 
Last edited:
if you'd like to do it in mysql code, either NOW() for a date field or UNIX_TIMESTAMP(NOW()) for an integer. hope that helps :)
 
Back
Top