1
kjs222
how to work with _priv_msgs:msg_time in sql
  • 2003/11/12 22:40

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


Can anyone tell me the SQL statement I could use to select msg_time as an interpretable date from _priv_msgs?

so for instance, something like:

select functionName(msg_time) from _priv_msgs;

Thanks,
keith

2
gstarrett
Re: how to work with _priv_msgs:msg_time in sql
  • 2003/11/14 5:26

  • gstarrett

  • Friend of XOOPS

  • Posts: 174

  • Since: 2002/3/12


Try these:

FROM_UNIXTIME(unix_timestamp
Returns a representation of the unix_timestamp argument as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS formatdepending on whether the function is used in a string or numeric context

mysqlselect FROM_UNIXTIME(875996580);
        -> 
'1997-10-04 22:23:00'
mysqlselect FROM_UNIXTIME(875996580) + 0;
        -> 
19971004222300
FROM_UNIXTIME
(unix_timestamp,format
Returns a string representation of the Unix timestampformatted according to the format stringformat may contain the same specifiers as those listed in the entry for the DATE_FORMAT() function: 

mysqlselect FROM_UNIXTIME(UNIX_TIMESTAMP(),
                            
'%Y %D %M %h:%i:%s %x');
        -> 
'1997 23rd December 03:43:30 x'


Look for more info in the MySQL docs.

3
kjs222
Re: how to work with _priv_msgs:msg_time in sql
  • 2003/11/14 12:45

  • kjs222

  • Friend of XOOPS

  • Posts: 116

  • Since: 2003/3/1 1


Hey gstarrett

Thanks for the reply; that works perfectly. I just couldn't figure out which function did it.

Again, thanks,
Keith

4
ackbarr
Re: how to work with _priv_msgs:msg_time in sql

Thanks also gstarrett - I looked at the MySQL docs to find this function, and must have overlooked it.

Login

Who's Online

218 user(s) are online (133 user(s) are browsing Support Forums)


Members: 0


Guests: 218


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits