-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Problems with converting SQL datediff(..) to Timespan
PostPosted: Thu Nov 17, 2005 4:35 am 
Beginner
Beginner

Joined: Thu May 12, 2005 2:14 am
Posts: 33
Location: Sweden, Sk
Hi

I need to get the timespan between to dates. I store thoose two dates as SQL DateTime types in the database.

In my custom query i do.

(isnull(cast( (select sum(datediff(s, StartTime, StopTime)) from workedTime where StartTime >= :startDate and StopTime <= :stopDate and workedTime.assistant_id = assistants.assistant_id) as bigint),0)
* 10000000) as {rep.WorkedTime}

But it seems to return wrong values for the timespan object.

Can somebody see where its wrong? Or is there some other way of doing it?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 4:50 am 
Beginner
Beginner

Joined: Thu May 12, 2005 2:14 am
Posts: 33
Location: Sweden, Sk
Nothing wrong with the sql or the conversion to the TimeSpan object... But when the timespan exceeds 24 hours it doesnt work to just display Hours.. :oops:

case solved


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.