hallo
ich suche die moeglichkeit, eine zeitangabe aus dem unixformat, zb 1004313600
in ein menschenlesbares format umzuwandeln.
mit date bekomme ich es irgendwie nicht hin,
da die option -d kein %s annimmt.
danke joerg
bash zeitformat
Re: bash zeitformat
Ui, da wollte ich schon die Waffen strecken, als "man date" nix verwertbares auswarf - aber "info date" hilft weiter! Aus der Node "Examples of date":
<pre>
To convert such an unwieldy number of seconds back to a more
readable form, use a command like this:
date -d '1970-01-01 946684800 sec' +"%Y-%m-%d %T %z"
2000-01-01 00:00:00 +0000
</pre>
Also vorgehen wie folgt:
<blockquote><pre><font size="1" face="">code:</font><hr><font face="Courier New" size="2">
MYTIME=1004313600
date -d "1970-01-01 $MYTIME"
</font><hr></pre></blockquote>
... und noch beliebig Format-Strings dazupappen.
Jochen
<pre>
To convert such an unwieldy number of seconds back to a more
readable form, use a command like this:
date -d '1970-01-01 946684800 sec' +"%Y-%m-%d %T %z"
2000-01-01 00:00:00 +0000
</pre>
Also vorgehen wie folgt:
<blockquote><pre><font size="1" face="">code:</font><hr><font face="Courier New" size="2">
MYTIME=1004313600
date -d "1970-01-01 $MYTIME"
</font><hr></pre></blockquote>
... und noch beliebig Format-Strings dazupappen.
Jochen
Re: bash zeitformat
super
das klappt toll
habe auch unter info date geschaut
aber nix gefunden
manche sind halt gut
danke
joerg
das klappt toll
habe auch unter info date geschaut
aber nix gefunden
manche sind halt gut
danke
joerg
Re: bash zeitformat
Gut, dass es Dir weiterhilft - obwohl ich einen Fehler gepostet habe. <img src="http://www.pl-forum.de/UltraBoard/Images/Sad.gif" border="0" align="middle">
Es sollte natürlich
<blockquote><pre><font size="1" face="">code:</font><hr><font face="Courier New" size="2">
MYTIME=1004313600
date -d "1970-01-01 $MYTIME <b>sec</b>"
</font><hr></pre></blockquote>
wie im Beispiel aus derm info-Seite sein...
Jochen
Es sollte natürlich
<blockquote><pre><font size="1" face="">code:</font><hr><font face="Courier New" size="2">
MYTIME=1004313600
date -d "1970-01-01 $MYTIME <b>sec</b>"
</font><hr></pre></blockquote>
wie im Beispiel aus derm info-Seite sein...
Jochen