How do I filter by [Today] and time in SharePoint list view ?
Asked Answered
C

3

7

I'm trying to filter Sharepoint lists based on date and time. But It only works with date, ignores the time in data and time field.

enter image description here

Claustral answered 21/8, 2013 at 16:26 Comment(0)
C
11

In SharePoint Designer I edit the CAML query from my view in Advanced Mode. And I add IncludeTimeValue="True" in CAML tag Value Type="DateTime". I'm filtering my results by time.

           <Query>
                <OrderBy>
                    <FieldRef Name="Modified" Ascending="FALSE"/>
                </OrderBy>
                <Where>
                    <Or>
                        <Gt>
                            <FieldRef Name="Start"/>
                            <Value Type="DateTime"  IncludeTimeValue="True">
                                <Today/>
                            </Value>
                        </Gt>
                        <Gt>
                            <FieldRef Name="TimeOver"/>
                            <Value Type="DateTime"  IncludeTimeValue="True">
                                <Today/>
                            </Value>
                        </Gt>
                    </Or>
                </Where>
            </Query>
Claustral answered 28/8, 2013 at 13:59 Comment(1)
Great hack man! This should be OOB. I think you meant Caml, this syntax makes me anything but calm lolProspectus
N
3

First, SharePoint filtering using the [Today] wildcard only compares dates, not times. To my knowledge there is no web interface way of comparing times.

Assuming "TimeOver" is a your project deadline and "Start" is when the project begins...

Add something to a list when it is overdue by saying: TimeOver is Less than [Today]

Add something to a list when it was started today: Start is equal to [Today]

Add something that was created in the past week: Start is greater than [Today]-7

Add something to a list that is due within 30 days: TimeOver is greater than [Today] AND TimeOver is less than [Today]+30

Niblick answered 27/8, 2013 at 18:26 Comment(1)
@Tabares: mind blown. im going back and reworking so many solutions based on this. Thanks!Niblick
P
0

Create a calculated column in NUMBER format (e.g. call it 'CreatNum'). The value of the column is the date field (e.g. =Created). Then filter by that field, as in CreateNum field is greater than 46,885.3313 (a date in number value). The same calculated column will convert existing date fields into numbers so you can easily tell what number value to filter on.

Papilla answered 16/1, 2015 at 19:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.