unixtime 1.0.0 copy "unixtime: ^1.0.0" to clipboard
unixtime: ^1.0.0 copied to clipboard

DateTime extension for treating Unix Time

UnixTime.dart #

This extension provides a way to access the UNIX time (seconds)

Installation #

With Dart:

 $ dart pub add unixtime

With Flutter:

$ flutter pub add unixtime

Import

import 'package:unixtime/unixtime.dart';

Usage #

To get the DateTime from UNIX time.

final datetime = 1669361095.toUnixTime();
// => 2022-11-25 16:24:55.000

You can create a UTC timezone with isUtc option.

final datetime = 1669361095.toUnixTime(isUtc: true);
// => 2022-11-25 07:24:55.000Z

To get UNIX timestamp from DateTime.

DateTime.now().unixtime
// => 1669361095
2
likes
130
pub points
79%
popularity

Publisher

verified publisherashphy.com

DateTime extension for treating Unix Time

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

More

Packages that depend on unixtime