添加2周(截至午夜)

时间:2016-07-18 11:49:09

标签: php datetime

我有$end = date('Y.m.d', strtotime("+2 weeks")); 日志目前距触发时间仅为+2周,但我如何才能在午夜结束?

例如:用户在下午1点32分触发日志,在23:59:59 2周后结束?

时间以unixtime格式存储在数据库中

2 个答案:

答案 0 :(得分:5)

def oddTuples(aTup):
    '''
    aTup: a tuple

    returns: tuple, every other element of aTup. 
    '''
    evenIndex = ()
    evenTuple = ()
    for i in aTup:
        if aTup.index(i)%2 == 0:
            evenIndex = evenIndex +  (aTup.index(i),)
            evenTuple += (aTup[aTup.index(i)],)
    return evenTuple

答案 1 :(得分:4)

echo $end = date('r', strtotime("+2 weeks +1 day midnight -1 sec"));
//  Mon, 01 Aug 2016 23:59:59 +0000