I'm trying to create a function that formats a time in a standard way ('%H:%i'). But all I can seem to get back is null.
DROP TABLE IF EXISTS bogus_table; CREATE TABLE IF NOT EXISTS bogus_table ( btime TIME );
INSERT INTO bogus_table VALUES ('12:34:56');
DROP FUNCTION IF EXISTS bogus ; DELIMITER $$ CREATE FUNCTION bogus ( btime TIME ) RETURNS VARCHAR(10) BEGIN DECLARE ctime VARCHAR(10) DEFAULT ''; SET ctime=DATE_FORMAT(btime,'%H:%i'); RETURN ctime; END $$ DELIMITER ;
SELECT btime, bogus(btime) AS btime1, DATE_FORMAT(btime,'%H:%i') AS btime2 FROM bogus_table;
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql
Jan 27
Peter Brawley Re: cannot pass time to function
Jan 27, 2012; 12:19
Peter Brawley
Re: cannot pass time to function
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!