[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 618
  • Last Modified:

want time that is 3 hours later

insert into
datetime field
values
NOW()


I want the time that is 3 hours later



NOW()+3
NOW()+30

both '2012-08-29 01:00:43'

NOW()+300
'0000-00-00 00:00:00'


how can I get
'2012-08-29 04:00:43'


I am working on godaddy shared server and I can not change mysql time
0
rgb192
Asked:
rgb192
2 Solutions
 
johanntagleCommented:
Say hello to the date_add function see http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add

date_add(now(), interval 3 hour)
0
 
Anuradha GoliCommented:
Change ur code based on this example
UPDATE events SET date_starts = DATE_ADD(date_starts,INTERVAL 2 HOUR) WHERE event_id = 3;

Open in new window

0
 
rgb192Author Commented:
both add to date

thanks
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now