# Syntax to assign a date value to a date field

**URL:** <https://www.starburst.io/community/forum/t/syntax-to-assign-a-date-value-to-a-date-field/1240>\
**Category:** Starburst Enterprise\
**Created:** [May 27, 2025, 6:45pm UTC](https://www.starburst.io/community/forum/t/syntax-to-assign-a-date-value-to-a-date-field/1240 "2025-05-27T18:45:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abedi](https://www.starburst.io/community/forum/letter_avatar_proxy/v4/letter/a/e19b73/32.png) [@Abedi](https://www.starburst.io/community/forum/u/Abedi)\
**Post date:** [May 27, 2025, 6:45pm UTC](https://www.starburst.io/community/forum/t/syntax-to-assign-a-date-value-to-a-date-field/1240/1 "2025-05-27T18:45:06Z")

</div>

if assigned like this as-of\_dt = 02/28/2023 , this errors - “Cannot apply operator: date = integer”

---

<div class="post-metadata">

**Author:** ![lester](https://www.starburst.io/community/forum/user_avatar/www.starburst.io/lester/32/138_2.png) [@lester](https://www.starburst.io/community/forum/u/lester)\
**Post date:** [May 27, 2025, 8:44pm UTC](https://www.starburst.io/community/forum/t/syntax-to-assign-a-date-value-to-a-date-field/1240/2 "2025-05-27T20:44:33Z")

</div>

I think you are trying to convert a string in that format into a date (or timestamp) value. If so, does this help?

```auto
-- parsing string 'mm/dd/yyyy' to a timestamp
SELECT date_parse('02/28/2023', '%m/%d/%Y');
-- returns 2023-02-28 00:00:00.000

-- if want a date instead of timestamp, just cast it
SELECT CAST(date_parse('02/28/2023', '%m/%d/%Y') AS date);
-- returns 2023-02-28

```

If you are wanting something different, just let me know.

---

<div class="post-metadata">

**Author:** ![Abedi](https://www.starburst.io/community/forum/letter_avatar_proxy/v4/letter/a/e19b73/32.png) [@Abedi](https://www.starburst.io/community/forum/u/Abedi)\
**Post date:** [May 30, 2025, 6:37pm UTC](https://www.starburst.io/community/forum/t/syntax-to-assign-a-date-value-to-a-date-field/1240/3 "2025-05-30T18:37:43Z")

</div>

this seems to work in a select but when compared to a date element it errors out

dt\_as\_of = CAST(date\_parse(‘04/30/2025’, ‘%m/%d/%Y’) AS date)

error - mismatched input ‘’. Expecting: ‘(’, ‘)’, ‘ARRAY’

---

<div class="post-metadata">

**Author:** ![lester](https://www.starburst.io/community/forum/user_avatar/www.starburst.io/lester/32/138_2.png) [@lester](https://www.starburst.io/community/forum/u/lester)\
**Post date:** [May 30, 2025, 7:09pm UTC](https://www.starburst.io/community/forum/t/syntax-to-assign-a-date-value-to-a-date-field/1240/4 "2025-05-30T19:09:30Z")

</div>

Maybe I need some more info on what you’re doing and what kind of table format you are using. Here are some examples for Iceberg running on Starburst Galaxy.

Was able to use this approach when inserting rows.

```auto
create table test_date (a_string varchar, a_date date)
with (type='iceberg');

insert into test_date values 
 ('Jan 1, 2025', CAST(date_parse('01/01/2025', '%m/%d/%Y') AS date)),
 ('Feb 9, 2025', CAST(date_parse('02/09/2025', '%m/%d/%Y') AS date));

select * from test_date;

```

 ![Screenshot 2025-05-30 at 3.06.31 PM](https://www.starburst.io/community/forum/uploads/default/original/1X/c89bead12a697e46398864beccd5d0f525642d54.png)

Was able to use this approach when performing a filter.

```auto
select * from test_date
 where a_date = CAST(date_parse('01/01/2025', '%m/%d/%Y') AS date);

```

 ![Screenshot 2025-05-30 at 3.07.06 PM](https://www.starburst.io/community/forum/uploads/default/original/1X/e95bcc801798477dac43124e4d2f44dc02327e04.png)

If this is still not working, please provide a bit more of your example. Preferably something I can reproduce. Good luck!
