How to round unix timestamp up and down to nearest half hour?

后端 未结 10 2080
名媛妹妹
名媛妹妹 2020-12-14 17:16

Ok so I am working on a calendar application within my CRM system and I need to find the upper and lower bounds of the half an hour surrorunding the timestamp at which someb

10条回答
  •  死守一世寂寞
    2020-12-14 17:30

    As you probably know, a UNIX timestamp is a number of seconds, so substract/add 1800 (number of seconds in 30 minutes) and you will get the desired result.

提交回复
热议问题