View Full Version : Current_Timestamp
333qaz333
02-03-2008, 09:03 PM
I am trying to insert a time 60 seconds before the current time... but its not working.
I get an error when i try:
UPDATE table SET time = CURRENT_TIMESTAMP - 60;
Any Suggestions?
oesxyl
02-03-2008, 11:11 PM
I am trying to insert a time 60 seconds before the current time... but its not working.
I get an error when i try:
UPDATE table SET time = CURRENT_TIMESTAMP - 60;
Any Suggestions?
UPDATE table SET time = from_unixtime(unix_timestamp() - 60);
best regards
333qaz333
02-04-2008, 12:21 PM
Thank you very much for your reply.
Unfortunately, either I am doing it wrong or that doesn't seem to work.
I don't get any errors, but the time seems to be the current time....
Thank you again for your help.
oesxyl
02-04-2008, 12:39 PM
Thank you very much for your reply.
Unfortunately, either I am doing it wrong or that doesn't seem to work.
I don't get any errors, but the time seems to be the current time....
Thank you again for your help.
can you post the table 'table' structure, maybe is something wrong there.
you can try also to see if this work:
select from_unixtime(unix_timestamp() - 60), from_unixtime(unix_timestamp());
it must work, :)
best regards
333qaz333
02-05-2008, 04:32 AM
THANK YOU!!!!!!!!!!!!!!!!!!!
You are right, your code works, i was just making a silly mistake on my end. Thank you very very very much!!
Just out of curiousity, what is unix time? whatever it is, it works...
oesxyl
02-05-2008, 04:56 AM
THANK YOU!!!!!!!!!!!!!!!!!!!
You are right, your code works, i was just making a silly mistake on my end. Thank you very very very much!!
I'm glad I can help you, :)
Just out of curiousity, what is unix time? whatever it is, it works...
it's an integer, if I'm not wrong, seconds since 1 jan 1970.
until 2012 you have no problem with it, :)
there is somewhere a definition, :)
PS: I see your site, it's fine, :)
best regards
ralph l mayo
02-05-2008, 11:50 PM
how about
UPDATE table SET time_col = DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 minute);
333qaz333
02-06-2008, 12:31 AM
until 2012 you have no problem with it
What happens in 2012?
PS: I see your site, it's fine, :)
Thanks, it doesn't work if my computer is off, but i guess you get what you pay for, and i paid nothing!!
ralph l mayo
02-06-2008, 12:51 AM
What happens in 2012?
Nothing. Unix time will overflow 32-bit representations on 2038 but MySQL will store it as a 64-bit value sometime prior to then anyway (if it doesn't already.)
oesxyl
02-06-2008, 12:57 AM
What happens in 2012?
I was wrong, :), is 2038. Cite from here:
http://dev.mysql.com/doc/refman/4.1/en/datetime.html
Remember that although DATETIME, DATE, and TIMESTAMP values all can be specified using the same set of formats, the types do not all have the same range of values. For example, TIMESTAMP values cannot be earlier than 1970 or later than 2038. This means that a date such as '1968-01-01', while legal as a DATETIME or DATE value, is not valid as a TIMESTAMP value and is converted to 0.
I'm agree with ralph l mayo, :), was just comment about timestamp
Thanks, it doesn't work if my computer is off, but i guess you get what you pay for, and i paid nothing!!
there are some solution for that, :), for example this one:
http://freedns.afraid.org/
best regards
333qaz333
02-06-2008, 01:49 AM
thanks.
I know i am getting off topic, but with that link you gave me, will it support a port other than 80? Right now I am using 8081 cause 80 is blocked by my ISP.
Thank you again for taking the time to help me. I really appreciate it.
Edit:
Hang on, even if I do get the ports set right, this still won't work when i turn off my computer right? or am i missing a hosting spot somewhere.
The only way my website will stay on when I turn off my computer is if the files are hosted online somewhere. Oh well..
oesxyl
02-06-2008, 02:01 AM
thanks.
I know i am getting off topic, but with that link you gave me, will it support a port other than 80? Right now I am using 8081 cause 80 is blocked by my ISP.
I don't know, you could ask them or post on forum, maybe somebody else could answer. :)
Edit:
Hang on, even if I do get the ports set right, this still won't work when i turn off my computer right? or am i missing a hosting spot somewhere.
The only way my website will stay on when I turn off my computer is if the files are hosted online somewhere. Oh well..
the reason I give you this link is that I remeber, I'm not sure, that they can mirror your site when is offline.
best regards
333qaz333
02-06-2008, 02:53 AM
hmm... that is interesting. i will check it out.
Thank you for all your help with everything, I really owe you one...
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.