0
I need to extract the hours and minutes of a timestamp in mysql, I tried to use maketime();
CREATE OR REPLACE FUNCTION agendar(dia timestamp) returns bool as
$$
declare
hora time := extract(hour from dia);
minuto time := extract(minute from dia);
horaminuto := maketime(hora,minuto,0);
but accuses of incorrect syntax. I need to extract the date and time to compare and see whether or not the timestamp has reached a time limit. For example, a trade that opens at 9:30 am, I need to check if the time that was passed on the timestamp is past before or after that time
The signature of the make_time function is make_time(hour int, min int, sec double Precision) and returns a time. The signature of the Extract function is Extract(field from timestamp) and returns a double Precision. Therefore the time and minute variable declaration as time is incorrect, should be double Precision or even an int.
– anonimo
A question: you are working with Mysql (as in the text of your question) or with Postgresql (as it is in the tag)?
– anonimo