Quiq::Formatter - Formatierung von Werten
Quiq::Object
$x = $class->normalizeNumber($x);
Entferne unnötige Nullen von einer Zahl, forciere als Dezimaltrennzeichen einen Punkt (anstelle eines Komma) und liefere das Resultat zurück.
123.456000 -> 123.456 70.00 -> 70 0.0 -> 0 -0.0 -> 0 007 -> 7 23,7 -> 23.7
$str = $class->readableNumber($x); $str = $class->readableNumber($x,$sep);
Formatiere eine Zahl $x mit Tausender-Trennzeichen $sep. Per Default ist $sep ein Punkt (.). Handelt es sich bei $x um eine Zahl mit Nachkomma-Stellen, wird der Punkt durch ein Komma (,) ersetzt.
.
,
1 -> 1 12 -> 12 12345 -> 12.345 -12345678 -> -12.345.678 -12345.678 -> -12.345,678
$str = $class->reducedIsoTime($now,$time);
Bezugszeitpunkt in Unix Epoch oder als ISO-Datum.
Zeit in Unix Epoch oder als ISO-Datum.
Reduzierte ISO-Zeitdarstellung (String)
Erzeuge eine "reduzierte" ISO-Zeitdarstellung für Zeitpunkt $time relativ zu Bezugszeitpunkt $now. Die unreduzierte ISO-Zeitdarstellung hat das Format:
YYYY-MM-DD HH:MM:SS
Die reduzierte Dastellung ist identisch aufgebaut, nur dass alle führenden Zeitkomponenten fehlen, die zum Bezugszeitpunkt $now identisch sind.
Diese Darstellung ist nützlich, um in einer Liste von Zeiten die nah am aktuellen Zeipunkt liegenden Zeiten leichter erkennen zu können, z.B. in einer Verzeichnisliste:
$ quiq-ls ~/dvl | rwxr-xr-x | xv882js | rvgroup | 2018-07-07 07:08:17 | | d | ~/dvl/.cotedo | | rwxr-xr-x | xv882js | rvgroup | 2018-06-29 11:06:38 | | d | ~/dvl/.jaz | | rwxr-xr-x | xv882js | rvgroup | 17 07:29:51 | | d | ~/dvl/Blob | | rwxr-xr-x | xv882js | rvgroup | 17 07:29:52 | | d | ~/dvl/Export | | rwxr-xr-x | xv882js | rvgroup | 17 07:29:52 | | d | ~/dvl/Language | | rwxr-xr-x | xv882js | rvgroup | 17 07:29:52 | | d | ~/dvl/Library | | rwxr-xr-x | xv882js | rvgroup | 37:47 | | d | ~/dvl/Package |
Keine gemeinsame Zeitkomponente:
Quiq::Formatter->reducedIsoTime(1558593179,1530940097); ==> 2018-07-07 07:08:17
Jahr und Monat sind gemeinsam:
Quiq::Formatter->reducedIsoTime(1558593179,1558070991); ==> 17 07:29:51
Alle Komponenten, bis auf die Sekunden, sind identisch:
Quiq::Formatter->reducedIsoTime(1558593179,1558593168); ==> 48
(alles in Zeitzone MESZ)
1.159
Frank Seitz, http://fseitz.de/
Copyright (C) 2019 Frank Seitz
This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Quiq, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Quiq
CPAN shell
perl -MCPAN -e shell install Quiq
For more information on module installation, please visit the detailed CPAN module installation guide.