11
JMorris
Re: Last Update: 1969/12/31?!
  • 2005/2/19 7:02

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Ok, I feel like a real dummy now. I just changed mylinks_links.date to varchar(100). In the SQL query box, I pasted "UPDATE table SET date = UNIX_TIMESTAMP(date)" without the quotes, then pressed go. This is the error I got:

Quote:
#1064 - You have an error in your SQL syntax near 'table SET date = UNIX_TIMESTAMP(date)' at line 1


Sorry, I'm a n00b to SQL, so could you dumb it down just a bit?

12
Dave_L
Re: Last Update: 1969/12/31?!
  • 2005/2/19 7:12

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Hmmmm ... maybe the function UNIX_TIMESTAMP won't work on a varchar column.

Plan B:

Change the column type back to "datetime".
Rename the column to "olddate".
Add a new column "date" of type "int".

UPDATE table SET date UNIX_TIMESTAMP(olddate)


I'd try this myself, but am too tired for that tonight.

13
hyperpod
Re: Last Update: 1969/12/31?!
  • 2005/2/19 9:41

  • hyperpod

  • Quite a regular

  • Posts: 359

  • Since: 2004/10/4


table needs to be the name of the table.

So:

UPDATE mylinks_links SET date = UNIX_TIMESTAMP(date)


Should do it.


Hope that works.


Cheers,

14
JMorris
[SOLVED]: Last Update: 1969/12/31?!
  • 2005/2/19 15:41

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


BINGO!

You were both really close, so with a little tinkering, I was able to get the following to work:

I changed date to:
int(10NOT NULL default '0'

Then used:
UPDATE xoopscitws_mylinks_links SET date UNIX_TIMESTAMP()


I also found a good page on this for future reference.

http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html

Thanks a million for all the help!!!

Login

Who's Online

164 user(s) are online (117 user(s) are browsing Support Forums)


Members: 0


Guests: 164


more...

Donat-O-Meter

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

Latest GitHub Commits