关于在注销字段中存储当前日期和时间

时间:2017-02-08 09:03:18

标签: javascript php mysql

此查询

a=[
     [[1, 2, 4], [2, 1, 3, 5], [3, 2, 6], ],
     [[4, 1, 5, 7], [5, 2, 4, 6, 8], [6, 3, 5, 9]],

   ]

def flat(a):
    for level1 in a:
        for level2 in level1:
            yield level2

result = {}
for l in flat(a):
    result[l[0]] = l[1:]

print result

告诉我今天的日期和时间。

我想显示昨天的日期和时间。我应该怎么写修改它?

1 个答案:

答案 0 :(得分:1)

如果你想昨天登录:

SELECT * FROM login_history WHERE user_id = 1 WHERE login_date BETWEEN SUBDATE( CURDATE( ) , 1 ) AND CURDATE( ) ORDER BY login_date DESC LIMIT 1

如果您想要之前登录:

SELECT * FROM login_history WHERE user_id = 1 ORDER BY login_date DESC LIMIT 1,1