SELECT EXTRACT(HOUR_SECOND FROM "1999-07-02 01:02:03");

-----Original Message-----
From: Johannes Pretorius [mailto:[EMAIL PROTECTED] 
Sent: woensdag 16 juli 2003 13:32
To: [EMAIL PROTECTED]
Cc: Pieter
Subject: RE: Simple newbie question - CURTIME()

Thanks
\0-\-==-0-=
I have seen my error and have changed it to be as follows :

//================== SNIP ==================

mysql> select date_add(now(),INTERVAL 6 HOUR);
+---------------------------------+
| date_add(now(),INTERVAL 6 HOUR) |
+---------------------------------+
| 2003-07-16 19:00:13             |
+---------------------------------+
1 row in set (0.00 sec)

//================ END SNIP ==================

Is this more correct ?

If I only need the time I use

//===================== SNIP ===============

mysql> select date_format(date_add(now(),INTERVAL 6 HOUR),'%H:%i:%s');
+---------------------------------------------------------+
| date_format(date_add(now(),INTERVAL 6 HOUR),'%H:%i:%s') |
+---------------------------------------------------------+
| 19:31:04                                                |
+---------------------------------------------------------+
1 row in set (0.03 sec)

//============== END SNIP ==========================

Thanks

Johannes


At 13:06 16/07/2003 +0200, you wrote:
>WRONG!
>
>What will happen in this case? The DB is converting/casting the DATE
>(curtime()) into an integer and then ads 60000. So what you get does
not
>necessarily represent a valid date/time!
>
>Just replace 060000 with 240000 and see what you yet.
>
>Cheers
>/rudy
>
>-----Original Message-----
>From: Johannes Pretorius [mailto:[EMAIL PROTECTED]
>Sent: woensdag 16 juli 2003 12:11
>To: [EMAIL PROTECTED]
>Subject: Re: Simple newbie question - CURTIME()
>
>Thanks I have figured it out, I only have to add 060000 to the
curtime()
>
>function as example :
>
>//====================== SNIP ============================
>mysql> select curtime() + 060000 as TimePlus6, curtime() as
>TheCurrenTime;
>+-----------+---------------+
>| TimePlus6 | TheCurrenTime |
>+-----------+---------------+
>|    180922 | 12:09:22      |
>+-----------+---------------+
>1 row in set (0.00 sec)
>
>//================= END SNIP ============================
>
>Thanks for help and response
>
>Johannes Pretorius
>
>
>At 12:08 16/07/2003 +0300, Egor Egorov wrote:
> >Johannes Pretorius <[EMAIL PROTECTED]> wrote:
> > > I have looked in the  manual and seem to be missing it or not
> > understanding
> > > correctly,
> > >
> > > The curtime() function resturns the current server time. my
problem
>is the
> > > clients are not in the same
> > > country as the server, thus the time of the system is 6 hours
>behind. We
> > > want to add 6 hours to the time on capturing of the
> > > data, but using curtime() and adding the difference gives the
wrong
>time
> > > back, must we add the amount seconds or minutes to the function
> > > to get the correct time ?
> >
> >If you use CURTIME() function, you can convert to the seconds with
> >TIME_TO_SEC() and then apply arithmetic operations. Another way, use
> >function NOW() and DATE_ADD()/DATE_SUB() functions:
> >         http://www.mysql.com/doc/en/Date_and_time_functions.html
> >
> >
> >
> >--
> >For technical support contracts, goto
>https://order.mysql.com/?ref=ensita
> >This email is sponsored by Ensita.net http://www.ensita.net/
> >    __  ___     ___ ____  __
> >   /  |/  /_ __/ __/ __ \/ /    Egor Egorov
> >  / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
> >/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
> >        <___/   www.mysql.com
> >
> >
> >
> >
> >--
> >MySQL General Mailing List
> >For list archives: http://lists.mysql.com/mysql
> >To unsubscribe:
>http://lists.mysql.com/[EMAIL PROTECTED]
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]

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

Reply via email to