Re: [PHP] Addtime is for 4.1, what can i use for 3.23? (pretty much 0T)
Hey, > Might be quicker for you to ask on a mysql mailing > list :) Yep, am waiting for the confirmation email... > I tried a couple of different things looking at the > mysql page > (http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html) > > but couldn't come up with a proper solution. Yep, then tried some weird stuff and it worked :-) INSERT INTO test2 VALUES (Curtime(), DATE_ADD(Now(), INTERVAL '5' minute)); Maybe this will help someone else out. Thanks for trying though. Cheers! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Addtime is for 4.1, what can i use for 3.23? (pretty much 0T)
http://dev.mysql.com/ On Tue, May 30, 2006 6:53 pm, Ryan A wrote: > Hey, > To simplify this lets say my table looks like this: > > a time default NULL, > b time default NULL > > This is what i run: > INSERT INTO test2 VALUES (Curtime( ) , > ADDTIME(Curtime( ) , "00:01:00")) > > since the db is version 3.23 (I cant ask the client > to upgrade) instead of 4.1, the above SQL is not > possible and this: > > SELECT curtime( ) + INTERVAL 60 minute > > is giving me null, has anybody else faced this? if so > how did you solve this? > > I can of course run a query from my script to get the > curtime and then add minutes to it in my php script > and then insert it accordingly but it seems too much > of a PITA to do that... or I dont have a choice? > > Thanks! > Ryan > > -- > - The faulty interface lies between the chair and the keyboard. > - Creativity is great, but plagiarism is faster! > - Smile, everyone loves a moron. :-) > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Addtime is for 4.1, what can i use for 3.23? (pretty much 0T)
Ryan A wrote: Hey Chris, ... SELECT curtime( ) + INTERVAL 60 minute is giving me null, has anybody else faced this? if so how did you solve this? ... What does select curtime(); give you? It gives me the correct time, eg: 03:23:01 Make sure that's valid before trying to add to it.. Yep, checked that, it is. Could also try: select now() + interval 1 hour; should come back the same (I think anyway). No, this works, its gives me back 2006-05-31 04:23:56 but I only need the time part not the date part thats why i am using curtime(). Ah. Yes. Might be quicker for you to ask on a mysql mailing list :) I tried a couple of different things looking at the mysql page (http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html) but couldn't come up with a proper solution. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Addtime is for 4.1, what can i use for 3.23? (pretty much 0T)
Hey Chris, ... > > SELECT curtime( ) + INTERVAL 60 minute > > > > is giving me null, has anybody else faced this? if > so > > how did you solve this? ... > What does > select curtime(); > give you? It gives me the correct time, eg: 03:23:01 > Make sure that's valid before trying to add to it.. Yep, checked that, it is. > Could also try: > > select now() + interval 1 hour; > > should come back the same (I think anyway). No, this works, its gives me back 2006-05-31 04:23:56 but I only need the time part not the date part thats why i am using curtime(). Thanks, Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Addtime is for 4.1, what can i use for 3.23? (pretty much 0T)
Ryan A wrote: Hey, To simplify this lets say my table looks like this: a time default NULL, b time default NULL This is what i run: INSERT INTO test2 VALUES (Curtime( ) , ADDTIME(Curtime( ) , "00:01:00")) since the db is version 3.23 (I cant ask the client to upgrade) instead of 4.1, the above SQL is not possible and this: SELECT curtime( ) + INTERVAL 60 minute is giving me null, has anybody else faced this? if so how did you solve this? What does select curtime(); give you? Make sure that's valid before trying to add to it.. Could also try: select now() + interval 1 hour; should come back the same (I think anyway). -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php