Jump to content

Recommended Posts

Hello there!

 

I have written this MySQL function:

 

DROP FUNCTION IF EXISTS optimaldb.TBC;
CREATE FUNCTION optimaldb.`TBC`(SectionID int(10), StartTime datetime) RETURNS datetime
BEGIN
  DECLARE PrevTime datetime;
  SELECT EndTime FROM PassSection WHERE EndTime < StartTime ORDER BY SectionID LIMIT 1 INTO PrevTime;
  RETURN StartTime - PrevTime;
END;

 

Into which I pass 2 variables i.e:

SELECT TBC(3451,'2010-04-01 06:03:12')

 

This is the error that keeps getting thrown up: MySQL Database Error: Incorrect datetime value: '9188914574.000000' for column 'TBC' at row 1

 

I'm not entirely sure what I have done wrong  :confused: as I have looked up this: http://dev.mysql.com/doc/refman/4.1/en/datetime.html and as far as I can see I am structuring the datetime correctly!

 

Any help would be really handy! :D

 

Thanks, Dan

 

Link to comment
https://forums.phpfreaks.com/topic/239435-datetime-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.