[opencms-dev] mySql query

TechnoSophos technosophos at gmail.com
Fri Apr 25 19:35:39 CEST 2008


OpenCms stores dates in microseconds since epoch (see java.util.Date).
MySQL uses seconds since epoch. So you can get approximate times with
this:

SELECT FROM_UNIXTIME(user_lastlogin / 1000) from CMS_USERS;

Matt

On Fri, Apr 25, 2008 at 5:20 AM, Christoph P. Kukulies
<kuku at physik.rwth-aachen.de> wrote:
>
>  I'm trying to quickly do some excerpt from the opencms database and
>  thought that it would be faster if I do a
>
>  mysql> use opencms
>  mysql> select user_name,user_lastlogin from cms_users;
>
>  But the stored date in Mysql is a timestamp (don't even know it that is
>  down by OpenCms as a Unix timestamp or a Mysql timestamp).
>
>  So does anyone know, how to convert the last_login timestamp to a human
>  readable DATE in the above SQL-statement?
>
>
>  OTOH I wouldn't mind about a OpenCMS code snippet that loops over all
>  users and prints the appropriate information.
>
>  Thanks.
>  --
>  Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
>
>  _______________________________________________
>  This mail is sent to you from the opencms-dev mailing list
>  To change your list options, or to unsubscribe from the list, please visit
>  http://lists.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list