Last active
August 29, 2015 14:07
-
-
Save erwan/a416bcf69d3e604d5c3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Date and Timestamp predicates | |
date_before = predicates.date_before("my.product.releaseDate", datetime.datetime(2014, 6, 1)) | |
date_after = predicates.date_after("my.product.releaseDate", datetime.datetime(2014, 1, 1)) | |
date_Between = predicates.date_between("my.product.releaseDate", datetime.datetime(2014, 1, 1), datetime.datetime(2014, 6, 1)) | |
day_of_month = predicates.day_of_month("my.product.releaseDate", 14) | |
day_of_month_after = predicates.day_of_month_after("my.product.releaseDate", 14) | |
day_of_month_before = predicates.day_of_month_before("my.product.releaseDate", 14) | |
day_of_week = predicates.day_of_week("my.product.releaseDate", "Tuesday") | |
day_of_week_after = predicates.day_of_week_after("my.product.releaseDate", "Wednesday") | |
day_of_week_before = predicates.day_of_month_before("my.product.releaseDate", "Wednesday") | |
month = predicates.month("my.product.releaseDate", "June") | |
month_before = predicates.month_before("my.product.releaseDate", "June") | |
month_after = predicates.month_after("my.product.releaseDate", "June") | |
year = predicates.year("my.product.releaseDate", 2014) | |
hour = predicates.hour("my.product.releaseDate", 12) | |
hour_before = predicates.hour_before("my.product.releaseDate", 12) | |
hour_after = predicates.hour_after("my.product.releaseDate", 12) | |
# Accessing Date and Timestamp fields | |
date = doc.get_date("blog-post.date") | |
date_year = date and date.as_datetime.year | |
update_time = doc.get_timestamp("blog-post.update") | |
update_hour = update_time and update_time.as_datetime.hours |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment