Ashu
Ashu

Reputation: 343

Sum of Timestamp and number of hours in MYSQL

Please help in achieving below result from mysql, I need to calculate sum

select CONVERT_TZ(current_timestamp,'UTC','US/Pacific'),SEC_TO_TIME(15080) as cal_hour_from_sec

Current Output

CONVERT_TZ(current_timestamp,'UTC','US/Pacific'), cal_hour_from_sec

2020-07-15 02:53:26 04:11:20

Desired Output(Sum of timestamp+hours)

2020-07-15  07:04:20

Upvotes: 0

Views: 66

Answers (1)

Helper
Helper

Reputation: 847

Use the function TIMESTAMPADD:

SELECT TIMESTAMPADD(SECOND , 15080, CONVERT_TZ(CURRENT_TIMESTAMP,'UTC','US/Pacific')) 

Upvotes: 1

Related Questions