Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tejainece/date_format

Format Dates
https://github.com/tejainece/date_format

Last synced: 4 days ago
JSON representation

Format Dates

Awesome Lists containing this project

README

        

# date_format

A simple API to format dates.

# Usage

Use `formatDate` function to format a `DateTime` object.

```dart
print(formatDate(DateTime(1989, 02, 21), [yyyy, '-', mm, '-', dd]));
```

Output:

> 1989-02-21

### Long month names

```dart
print(formatDate(DateTime(1989, 2, 21), [yy, '-', M, '-', d]));
```

Output:

> 89-feb-21

### Time parts

```dart
print(formatDate(
DateTime(1989, 02, 1, 15, 40, 10), [HH, ':', nn, ':', ss]));
```

Output:

> 15:40:10

### Timezone

```dart
print(formatDate(
DateTime(1989, 02, 1, 15, 40, 10), [HH, ':', nn, ':', ss, z]));
```

Output:

> 15:40:10+0100