# DATE

> DATE function in StackQL: return a date as a YYYY-MM-DD string from a time value and optional modifiers.

Source: https://stackql.io/language-spec/functions/datetime/date

Returns a date string in the format YYYY-MM-DD.  

See also:  
[[` SELECT `]](/language-spec/select) [[ Date Modifiers ]](/language-spec/functions/datetime/date_modifiers) 

* * * 

## Syntax

```sql
SELECT DATE(datetime_expression [, modifier, ...]) FROM <multipartIdentifier>;
```

## Arguments

__*datetime_expression*__  
The datetime value.

__*modifier*__  
Zero or more modifiers to be applied to the *datetime_expression*.  For more information about modifiers, see [**Date Modifiers**](/language-spec/functions/datetime/date_modifiers)

## Return Value(s)

Returns a string representing the date component of the input *datetime_expression* with the *modifier* applied.

* * *

## Examples

### Return the date component of a datetime value

```sql
SELECT name, timeCreated,
date(timeCreated) as date_only
FROM google.storage.buckets WHERE project = 'stackql';
```

### Return the local date component of a datetime value

```sql
SELECT name, timeCreated,
date(timeCreated, 'localtime') as local_date
FROM google.storage.buckets WHERE project = 'stackql';
```

For more information, see [https://www.sqlite.org/lang_datefunc.html](https://www.sqlite.org/lang_datefunc.html)
