Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date Time Problem..!!

Author  Topic 

Jindal
Starting Member

3 Posts

Posted - 2009-11-17 : 08:08:42
I am using datediff function for getting difference between Start Time & End Time.

All are working fine, but i need following scenario.

If any users Start time is
11/16/2009 23:00

and End Time is
11/17/2009 00:05

result is coming perfect but i want to consider this user in 11/17/2009.

on day filtering its neither coming in 11/16 nor in 11/17.

i want to consider this result in 11/17.

Could any one help me to get this working.

Thanks,

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-11-17 : 08:38:08
sorry i don't quite understand what do you want here .

"on day filtering its neither coming in 11/16 nor in 11/17"
How do you filter the date ? How do you want to filter ? using start time or end time ?
like this ?
where start_time >= '20091116' and start_time < '20091117'


"i want to consider this result in 11/17."
What do you mean by that ? can you explain further with some sample data and required result ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Jindal
Starting Member

3 Posts

Posted - 2009-11-17 : 10:05:35
quote:
Originally posted by khtan

sorry i don't quite understand what do you want here .

"on day filtering its neither coming in 11/16 nor in 11/17"
How do you filter the date ? How do you want to filter ? using start time or end time ?
like this ?
where start_time >= '20091116' and start_time < '20091117'


"i want to consider this result in 11/17."
What do you mean by that ? can you explain further with some sample data and required result ?


KH
[spoiler]Time is always against us[/spoiler]





Thank you for your reply,

actually i am doing project in which one user start his task suppose on 11/16/2009 23:00 and same user complete his task on 11/17/2009 00:05.

now admin want to check task done From 11/16/2009 To 11/16/2009 i.e. on 11/16/2009.

or admin want to check task done From 11/17/2009 To 11/17/2009 i.e. on 11/17/2009.

In both case i will not get result 65 min.

Now, if admin check record From 11/16/2009 To 11/17/2009.

it will show result.

But i want to consider result on (From 11/17/2009 To 11/17/2009 i.e. on 11/17/2009.)

Thank You,
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-11-17 : 10:20:41
then just check on the end_time

for example to show task from 2009-11-17 to 2009-11-17

where end_time >= '20091117'
and end_time < dateadd(day, 1, 20091117)



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Jindal
Starting Member

3 Posts

Posted - 2009-11-18 : 04:03:45
quote:
Originally posted by khtan

then just check on the end_time

for example to show task from 2009-11-17 to 2009-11-17

where end_time >= '20091117'
and end_time < dateadd(day, 1, 20091117)



KH
[spoiler]Time is always against us[/spoiler]





Hey thx, it's working now.
Go to Top of Page
   

- Advertisement -