Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tejainece/date_format
Format Dates
https://github.com/tejainece/date_format
Last synced: 4 days ago
JSON representation
Format Dates
- Host: GitHub
- URL: https://github.com/tejainece/date_format
- Owner: tejainece
- License: bsd-3-clause
- Created: 2018-01-14T00:02:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-21T12:07:58.000Z (5 months ago)
- Last Synced: 2024-12-24T20:05:49.376Z (11 days ago)
- Language: Dart
- Size: 58.6 KB
- Stars: 86
- Watchers: 3
- Forks: 79
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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