# Obtain week of a date

**URL:** <https://community.dremio.com/t/obtain-week-of-a-date/833>\
**Category:** Uncategorized\
**Created:** [March 1, 2018, 9:33pm UTC](https://community.dremio.com/t/obtain-week-of-a-date/833 "2018-03-01T21:33:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![josue.cano](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@josue.cano](https://community.dremio.com/u/josue.cano)\
**Post date:** [March 1, 2018, 9:33pm UTC](https://community.dremio.com/t/obtain-week-of-a-date/833/1 "2018-03-01T21:33:24Z")

</div>

I need to get the week out of the year depending on the date, how could I?

---

<div class="post-metadata">

**Author:** ![doron](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/doron/32/294_2.png) [@doron](https://community.dremio.com/u/doron)\
**Post date:** [March 1, 2018, 9:47pm UTC](https://community.dremio.com/t/obtain-week-of-a-date/833/2 "2018-03-01T21:47:07Z")

</div>

Hi,

In the UI, you can click on `Add Field` and user the following sql:

```sql
date_part('week', "my_date_col")

```

That will get you the week number (1-52) of a given DATE, TIME or DATETIME field.

---

<div class="post-metadata">

**Author:** ![josue.cano](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@josue.cano](https://community.dremio.com/u/josue.cano)\
**Post date:** [March 1, 2018, 9:50pm UTC](https://community.dremio.com/t/obtain-week-of-a-date/833/3 "2018-03-01T21:50:27Z")

</div>

hey men thank you, It works very well.
