formatTimestampInMilliseconds function
Formats a timestamp in milliseconds since epoch into a date string.
The timestamp must be positive, and this function supports
all options provided by formatDateTime
.
Implementation
Future<String> formatTimestampInMilliseconds({
required int timestamp,
bool use24HourFormat = false,
String languageCode = 'en',
bool showTime = true,
String? countryCode,
bool isUtc = false,
}) async {
if (timestamp < 0) {
throw ArgumentError('timestamp must be a positive integer');
}
return formatDateTime(
DateTime.fromMillisecondsSinceEpoch(timestamp, isUtc: isUtc),
use24HourFormat: use24HourFormat,
languageCode: languageCode,
countryCode: countryCode,
showTime: showTime,
);
}