Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
wie wandele ich die unix zeit in die normale Uhrzeit?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
schrippe
Guru
Guru


Joined: 03 Mar 2004
Posts: 556
Location: Mülheim

PostPosted: Tue Aug 30, 2005 7:57 am    Post subject: wie wandele ich die unix zeit in die normale Uhrzeit? Reply with quote

hallo,

habe hier jede menge sekunden seit 1970. da gibts doch sicherlich nen proggi was das umrechnen kann, oder?

1124968017432255 = ?:?:?
_________________
for i in $(seq 1 565); do echo 'A$i: entweder rechts fahren oder rechts überholen dürfen!';done
Back to top
View user's profile Send private message
Vaarsuvius
Guru
Guru


Joined: 02 Dec 2004
Posts: 345

PostPosted: Tue Aug 30, 2005 8:32 am    Post subject: Reply with quote

google hilft.
http://www.unixtime.de/index.php?calc=2
1124968017432255 = 19.01.2038 04:14:07
Back to top
View user's profile Send private message
schrippe
Guru
Guru


Joined: 03 Mar 2004
Posts: 556
Location: Mülheim

PostPosted: Tue Aug 30, 2005 9:07 am    Post subject: Reply with quote

und wie mache ich das, wenn ich es in einem script benutzen will??
_________________
for i in $(seq 1 565); do echo 'A$i: entweder rechts fahren oder rechts überholen dürfen!';done
Back to top
View user's profile Send private message
Arudil
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2004
Posts: 144

PostPosted: Tue Aug 30, 2005 9:28 am    Post subject: Reply with quote

hehe

1124968017432255 = 19.01.2038 04:14:07
stimmt nicht wirklich ;)

denn: 2147483647 = 19.01.2038 04:14:07

das obere Ergebniss kommt nur durch einen Pufferoverflow im 32bit-timestamp zustande. Und deshalb geht eine Sekunde nach 2147483647 auch die Welt unter. Aber das ist ein anderes Thema. (->)

im Script kannst du folgendes verwenden:
date -d "1970-01-01 UTC 2147483647 seconds" +%x\ %X
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Tue Aug 30, 2005 9:33 am    Post subject: Reply with quote

oder so:
Code:
perl -e 'print scalar localtime 1125394309'

_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
_hephaistos_
Advocate
Advocate


Joined: 07 Apr 2004
Posts: 2694
Location: salzburg, austria

PostPosted: Tue Aug 30, 2005 9:59 am    Post subject: Reply with quote

oder php date()
date("YmdHis", sometsp);
- geht auch via CLI

hth,
ciao
_________________
-l: signature: command not found
Back to top
View user's profile Send private message
toskala
Advocate
Advocate


Joined: 14 Dec 2002
Posts: 2080
Location: hamburg, germany

PostPosted: Tue Aug 30, 2005 10:41 am    Post subject: Reply with quote

Code:
toskala@nemesis ~ $ cat bin/unixtimeconverter.sh
#!/bin/bash

if [ a$1 == "a" ]; then
        echo -e "usage: unixtimeconvert.sh <seconds>";
        exit 0;
fi

UNIXTIME="$1"
DATE=$(date -d "1970-01-01 UTC $UNIXTIME seconds" +"%Y-%m-%d %T %z")
echo -e "$DATE";


schreib das in nen bashscript, dann kannste es mit dem unixtime parameter aufrufen...

achja, edit:
naja, du kannst ja den date aufruf in jedem anderen bash-script verwenden, dann kannste das zerhackstücken und woanders reinstopfen
_________________
adopt an unanswered post
erst denken, dann posten
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum