Basically I'm trying to put a timestamp in MySQL for each user that tells me the date they registered. I have the date column in the MySQL table as an integer, and when they register basically I assign the time() function to that integer. Then, when I call the date in the member list, I use date("m/d/y",$row['register_date']) to pull the UNIX timestamp and convert it to something nice. Anyway, the whole point of the story is I am getting the date of 12/31/69 (i remember something about the timestamp starting at 1970 but I don't know why its giving me this). Any ideas? Thanks a lot.
First off, the time stamp is the number of seconds since January 1, 1970, what is know as the UNIX epoch. The idea actually comes from Star Trek. As we all know, the "Star Date" is the amount of time since the federation was formed. Or something like that. They guy liked the idea.
Second, I may be wrong here, but check it: you say the date column in your database is an integer. Yet, when you go to store it, you try to store it as a string (The output of the date function). After all, slashes aren't integers, now are they? I think that may be the problem.
I haven't tried the timestamp yet, but I do know that it has something to do with calling it from mySQL and placing it in the table in that format. I used the same date() function without calling it from mySQL and I got the correct date and output. I was thinking... I know they have int, bigint, ect... is there a limit to how big an int can be and what is it? The UNIX timestamp isn't too long but could that be the problem? I'll try the timestamp output also but from what I've read on the frihost forums int is the best way to go.
I got it! Thanks for the ideas.
The problem was this: I was using the function time() while defining VALUES in MySQL. Apparently this is invalid. Simple fix was just to create a variable like $time=time() and then assigning the variable $time to VALUES in the table.