如何最后登录? [英] How to get last logged in?

查看:104
本文介绍了如何最后登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有dB的lastactive,当用户登录当前日期进入该字段时。我现在的时区对我来说也是错误的时间。



我希望能够在最后一次活动时获得好处吗?



有人可以帮忙吗?我需要两个字段



我尝试过:



- 只需更新更新用户登录时间的sql查询。

Hi I have dB with lastactive which when user logs in current date goes into that field. My current timezone is also putting in the wrong time for me too.

I want to be able to get difference of when they were last active?

Can anyone help? Do I need two fields

What I have tried:

- just update sql query that updates the time user logs in.

推荐答案

始终将日期时间存储为UTC并以二进制格式存储。那么你对时区,差异时间和字符串转换没有任何问题。避免从不同来源(尤其是来自客户端系统)获取时间。
Always store datetimes as UTC and in binary format. Then you have no problems with time zones, diff times, and string conversions. Avoid also getting times from different sources (especially from client systems).


这篇关于如何最后登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆