Fieldy Posted October 26, 2006 Share Posted October 26, 2006 PHP uses a timestamp in seconds from 1970 and MySQL uses a timestamp like 20061026193021. I like to save the timestamp in to a database. What is the most common way? Wich one should i choose and why? I see that PhpBB saves the PHP timestamp in a varchar field, why didn't they choose a MySQL timestamp field for it? Quote Link to comment https://forums.phpfreaks.com/topic/25207-what-timestamp/ Share on other sites More sharing options...
wildteen88 Posted October 26, 2006 Share Posted October 26, 2006 PHP uses a UNIX Time stamp which is the number of seconds passed since 1st Jan 1970I use UNIX timestamps, by using the time() function to get the timestamp of now or use strtotime to convert a date format into a time stamp, eg 12/06/2006 (dd/mm/yyyy) into a UNIX timestamp which produces the follow: 1165363200 I generally use INT as the data type when storing timestamps in MySQL. However you can use a TIMESTAMP as the data type if you want to. Its up to you when creating your database schema. Quote Link to comment https://forums.phpfreaks.com/topic/25207-what-timestamp/#findComment-114964 Share on other sites More sharing options...
Fieldy Posted October 27, 2006 Author Share Posted October 27, 2006 Ok, but what are the advantages of both methods? Which should i choose of these? Quote Link to comment https://forums.phpfreaks.com/topic/25207-what-timestamp/#findComment-115464 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.