At 14:35 +0100 8/7/03, Andy Jackman wrote:
Hi,
I'm using v 3.23.46-nt and the C API.

The manual says under 'Changes in release 3.20.17' that:
Change FROM_DAYS() and WEEKDAY() to also take a full TIMESTAMP or DATETIME as
argument. Before they only took a number of type YYYYMMDD or YYMMDD.

I'm confused since this doesn't seem to be the case. If I do SELECT from_days(731799); I get today's date. But if I try and pass a 'timestamp' I get '0000-00-00' e.g. SELECT from_days(now());

1) Is this a doc bug or am I not passing the 'timestamp' in the right
way?

Looks like a doc bug to me. The change note probably should say TO_DAYS() rather than FROM_DAYS(). FROM_DAYS() takes a value in days, usually obtained by passing a date or datetime or timestamp to TO_DAYS().

2) I'm trying to get/set the date and time in a datetime column without
having to use formatted date strings ('yyyy-mm'dd hh:mm:ss'). I hoped to
use a long long integer to store the datetime as the number of seconds
(or any smaller unit) since the epoch. If from_days()/to_days() aren't
the functions to do this are there similar functions in mysql which
handle the time as well as the date? I don't want to use from_unixtime()
as I think the dates screw up in 2038.

TO_DAYS()/FROM_DAYS() don't use seconds in any case, so you may not want to use them for this.


Thanks, Andy.


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to