1. Helge Tjelta
  2. Valentina Studio
  3. Monday, August 12 2019, 08:02 PM
  4.  Subscribe via email
When entering:
datediff(Time_end, Time_start, 'second')as seconds it shows the right number

but
Sec_to_time(datediff(Time_end, Time_start, 'second')as seconds) shows <NULL>

Any idea; why can I not get a H:M:S from my DateDiff that returns seconds ???...
Comment
There are no comments made yet.
Ivan Smahin Accepted Answer
Seems to be a bug. What the values in Time_end and Time_start?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 1
Helge Tjelta Accepted Answer
Full date and time. Inputted in studio for the test.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 2
Ivan Smahin Accepted Answer
It seems that seconds could not be represented as a Time_value because there is a date part also.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 3
Helge Tjelta Accepted Answer
But why does: datediff(Time_end, Time_start, 'second')as seconds shows the right number then ?

isn't it the same... but with one added expression ?

or is it that the sec_to_time, needs a number and not a string...

is there a command for converting string to number. like VAL(string) ?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 4
Ivan Smahin Accepted Answer

select datediff( '08/13/2019 00:00:00', '07/13/2019 00:00:00', 'second')
-- 2678400


It is correct. But how "month" could be represented as a time_value? It must be a DateTime.


select dateadd( '07/13/2019 00:00:00', 'second', 2678400 )
-- '08/13/2019 00:00:00'
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 5
Helge Tjelta Accepted Answer
Ok, try this:

select datediff( '08/14/2019 01:30:00', '08/13/2019 20:30:00', 'second')
result: 18000
Now put that into sec_to_time
select sec_to_time (datediff( '08/14/2019 01:30:00', '08/13/2019 20:30:00', 'second'))
result: <NULL>
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 6
Ivan Smahin Accepted Answer
Seems to be a bug.

You may use following as a workaround:


set @val_seconds = select datediff( '08/14/2019 01:30:00', '08/13/2019 20:30:00', 'second');
select sec_to_time( @val_seconds);
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 7
Ivan Smahin Accepted Answer
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 8
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 0 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories
Omegabundle
  1. 0 subcategories