Help in Filtering DATETIME by by time -hours
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Dear All
Would you know if there is a formula/function to filter a DATETIME column on the basis of TIME. In other words I would like to filter occurrences of events, everyday, lets say between 2:00 AM and 5PM in last month. The DATETIME format that I have is YYYY-MM-DD HH:MI:SS.
Thank you in advance
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @RafalRazny,
This method works:
You just need to separate out the time variable as a time data type and compare that to a string in a time format.
Any questions or issues please ask
Ira Watt
Technical Consultant
Watt@Bulien.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Within a filter tool, just put this: DateTimeHour([DTField])>2 and DateTimeHour([DTField])<17
Where DTField is the field you are filtering on.
No need for a separate formula.
Just make sure the DTField is a DateTime datatype, otherwise it will likely return a 0 for the hour.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Obviously if you want to include 2AM and 5PM you'd change it to >= and <= in there. 😀
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you! I have used the DateTimeHour function in Filter tool and it works well!. Great job @DanielG and @DataNath!
