timestamp_to_string 0.0.1 timestamp_to_string: ^0.0.1 copied to clipboard
A timestamp to readable string or timestamp to date converter is a function that takes a timestamp as input and returns a human-readable date string
Timestamp-to-date Converter #
Timestamp-to-Readable-String-Converter #
Description #
A timestamp to readable string or timestamp to date converter is a function that takes a timestamp as input and returns a human-readable date string in a specific format (such as "DayName, MonthName Date, Year"). This is useful for presenting timestamps in a more user-friendly way, and can be customized to match a variety of date and time formats.
Screenshots #
Installation #
To use this package, add timestamp_to_string
as a dependency in your pubspec.yaml file.
Example #
import 'package:flutter/material.dart';
import 'package:timestamp_to_string/timestamp_to_string.dart';
class Example extends StatefulWidget {
@override
_ExampleState createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
@override
Widget build(BuildContext context) {
returnScaffold(
appBar: AppBar(
title: const Text('Timestamp to string example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// Current time
Center(child: CurrentTimeToString.now()),
/// 2019-01-01 12:00:00
// Specific timestamp, in a specific format
Center(child: TimestampToString.dddmmmddyyyy('1546300800')),
/// Wed, Jan 01, 2019
],
),
),
);
}
}
Parameters #
TimestampToString #
provide a timestamp in seconds in string format
TimestampToString.dddmmmddyyyy('$timestamp') // Wed, Jan 01, 2019
TimestampToString.yyyymmddhhmmss(timestamp.toString()) // 2019/01/01 12:00:00
Usage formate #
Format | Description |
---|---|
.ddmmyyyy | 01/01/2019 |
.yyyymmdd | 2019/01/01 |
.yyyymmddhhmmss | 2019/01/01 12:00:00 |
.ddmmyyyyhhmmss | 01/01/2019 12:00:00 |
.dddmmmddyyyy | Wed, Jan 01, 2019 |
.noFormater | February 24, 2021 7:16:40 AM |
.now | February 24, 2021 7:16:40 AM |
Usage #
TimestampToString.now() // February 24, 2021 7:16:40 AM
TimestampToString.ddmmyyyy('$timestamp') // 01/01/2019
TimestampToString.yyyymmdd('$timestamp') // 2019/01/01
TimestampToString.yyyymmddhhmmss('$timestamp') // 2019/01/01 12:00:00
TimestampToString.ddmmyyyyhhmmss('$timestamp') // 01/01/2019 12:00:00
TimestampToString.dddmmmddyyyy('$timestamp') // Wed, Jan 01, 2019
TimestampToString.noFormater('$timestamp') // February 24, 2021 7:16:40 AM
CurrentTimeToString #
CurrentTimeToString.now() // February 24, 2021 7:16:40 AM
Usage formate #
Format | Description |
---|---|
.ddmmyyyy | 01/01/2019 |
.yyyymmdd | 2019/01/01 |
.yyyymmddhhmmss | 2019/01/01 12:00:00 |
.ddmmyyyyhhmmss | 01/01/2019 12:00:00 |
.dddmmmddyyyy | Wed, Jan 01, 2019 |
.noFormater | February 24, 2021 7:16:40 AM |
.now | February 24, 2021 7:16:40 AM |
Usage #
CurrentTimeToString.ddmmyyyy() // 01/01/2019
CurrentTimeToString.yyyymmdd() // 2019/01/01
CurrentTimeToString.yyyymmddhhmmss() // 2019/01/01 12:00:00
CurrentTimeToString.ddmmyyyyhhmmss() // 01/01/2019 12:00:00
CurrentTimeToString.dddmmmddyyyy() // Wed, Jan 01, 2019
CurrentTimeToString.noFormater() // February 24, 2021 7:16:40 AM
CurrentTimeToString.now() // February 24, 2021 7:16:40 AM
Github Repository #
Author #
Shubham Kumar - Github
Also See #
Package | Description |
---|---|
Single Text Field | A Flutter package for creating a single text field. |
Drop Down List Menu | A Flutter package for creating a drop down list menu. |
dad Jokes | A Flutter package for getting dad jokes. |