---
title: "date"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/sline/filter/date'
  md: 'https://developer.shopline.com/docs/sline/filter/date.md'
---

# date


    Converts a date string into a specified format.   
You can use built-in format types or use placeholders to customize the output format.

    



    
`date_string | date(format=format)` returns a string.
    



    
        ## Required params

        
             `date_string` `string`\: A date string. Format: [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). Example: `2024-08-31T02:20:26+08:00`.
        
    



    
        ## Optional params

        
             `format` `string`\: The target output format. You can use a built-in format type or a custom format. For more information on how to use placeholders to customize the output format, refer to [strftime reference and sandbox](https://www.strfti.me/). If you want to use a built-in format type, valid values are:
- `default` (default): A format including the weekday, date, specific time, and timezone offset. Example: `Monday, December 31, 2018 at 1:00 pm -0500`.
- `abbreviated_date`: An abbreviated date. Example: `Dec 31, 2018`.
- `basic`: A basic numeric date format. Example: `12/31/2018`.
- `date`: A full date. Example: `December 31, 2018`.
- `date_at_time`: A date with the specific time. Example: `December 31, 2018 at 1:00 pm`.
- `on_date`: A date preceded by a preposition. Example: `on Dec 31, 2018`.
        
    



    
## Example

        
            

            The following example is used to convert date strings into three different formats.

            

            
<SlineExample path={'/'} objects={ 
    [""] 
}>
```sline
{{ "2022-04-14T16:56:02-04:00" | date() }}

{{ "2022-04-14T16:56:02-04:00" | date(format="basic") }}

{{ "2022-04-14T16:56:02-04:00" | date(format="%B %d, %Y") }}
```
</SlineExample>
            
        
    
