View Full Version : Date Conversion from MySQL table
KeltinAlexander
9-11-07, 08:23 PM
I am trying to prune down my PHPNuke users table, and run into a problem when I am looking at the data. Under PHPMyAdmin, the user_lastvisit field is not formatted as a date, but rather as a series of numbers. (ie -- 1107035796)
How can I get it where I can view the date of this field in dd/mm/yyyy format?
I've tried exporting to XLS and converting the field, but only get ######### as an entry. Same with Access.
HalfaBee
9-11-07, 08:29 PM
It is probably a unix timestamp.
select from_unixtimestamp( 1107035796 )
should show the real time/date
KeltinAlexander
9-11-07, 08:56 PM
That was it! Thanks!
Neat Pete
9-11-07, 09:27 PM
Yea, it's the number of seconds since midnight on 31/12/1969. 1.1 billion is about the right number.
In the year 2038, it will hit 2 billion, and any 32 bit computers still running will probably crash. Consultants will make a fortune warning about this, just like they scared the daylights out of everybody with Y2K back in 1999.
Where I was working at the time, you have never seen so much attention to detail as there was when signing off about checking for the Y2K bug. I commented that if the same amount of care was put into planning and signing off normal projects, quality would have been far higher.
Y2K was the biggest nothing ever. Like Pete's place of employment, people were running around making sure things were "fixed". We even had one poor guy who had to spend 1999 going into 2000 at the building! Heard later the bosses brought his wife, 2 kids and a bottle of champagne into the office.
HalfaBee
9-11-07, 11:08 PM
Y2K was a big nothing because most of the problems were fixed.
We had to do a Y2K compliance on a big neon sign<sigh>
Like it would care if it was 1999 or 2000
Neat Pete
9-12-07, 12:01 AM
That's right - they solved at great expense a problem that did not exist.
One can only be reminded of this lunatic asylum joke....
First Looney: He is walking about, tearing up paper into small pieces and throwing the pieces on the ground.
Second Looney: Why are you throwing the pieces of paper on the ground?
First Looney: To keep the elephants away.
Second Looney: But there's no elephants round here.
First Looney: Effective isn't it.
HalfaBee
9-12-07, 12:08 AM
So if software updates etc were not done before 2000 there would have been no problems?
I looked at it as preventative maintenance, fix the problem before it breaks and the world blows up. :)
Of course it was blown completely out of proportion.
Neat Pete
9-12-07, 12:44 AM
My spin on it says the Y2K "problem" was actually very easy to understand, even for hopeless managers and non-technical managers. The Y2K bug gave these people an opportunity to "manage" something for once.
So that's what they did, to the admiration of all but experienced programmers who knew it was a total hoax. The scam was especially constructed by the big consulting companies and the "expert" speakers who went from from seminar to seminar from 1993 onwards scaring everybody who was stupid enough to listen. Meanwhile, as HalfaBee notes, real programmers had been fixing it for years.
For many the problem simply came down to not knowing the Century when you only have a two digit year. The following code was published in a letter to the IT pages of "The Australian" way back in 1998.
If two-digit-year less than 30 then
Century = 20
else
Century = 19
end if
This gave most people a breather of 30 years!!!! But some still hired consultants to pay for this five-line solution.
Consultants said you had to check every line of Cobol you had ever written, and they said they could do it for $1 per line. Otherwise planes would be dropping out of the sky everywhere.
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.