FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-15-2010, 04:10 AM
T o n g
 
Default Decode unixtime

Hi,

Which tool can help me decode the Unix time? E.g., strings like
1257624539, 1258162046, 1257623988, 1257709563, etc. they are about 68
days ago.

Thanks

--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-15-2010, 04:20 AM
Chris Jackson
 
Default Decode unixtime

T o n g wrote:

> Hi,
>
> Which tool can help me decode the Unix time? E.g., strings like
> 1257624539, 1258162046, 1257623988, 1257709563, etc. they are about 68
> days ago.
>
> Thanks
>


It's not well documented, but: date -d, with an '@' before it:

chrisj@hercule$ date -d '@1257624539'
Sat Nov 7 20:08:59 GMT 2009

--
Chris Jackson
Shadowcat Systems Ltd.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-15-2010, 06:09 AM
Paul E Condon
 
Default Decode unixtime

On 20100115_051059, T o n g wrote:
> Hi,
>
> Which tool can help me decode the Unix time? E.g., strings like
> 1257624539, 1258162046, 1257623988, 1257709563, etc. they are about 68
> days ago.
>
> Thanks
>

date contains the standard time/date handling code, but it is
inconvenient to give it a ten digit Unix time number. Where are you
getting these numbers? I suggest that you change the way you get the
numbers so that they are both human readable and parsable by simple
code. I like date +%Y%m%d_%H%M%S

This gives a string of 15 bytes that sorts to the same order as the UNIX
time number and is visually understandable with only a little effort.
(It has no embedded spaces and is almost as compact as 10 digit Unix time.)

If the time of interest is the modification time of file, foo, the
command is

date +%Y%m%d_%H%M%S -r foo

For the mod time of foo in the UTC time zone use

date +%Y%m%d_%H%M%S -ur foo

See, man date

--
Paul E Condon
pecondon@mesanetworks.net


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-15-2010, 06:14 AM
Alex Samad
 
Default Decode unixtime

On Fri, Jan 15, 2010 at 12:09:33AM -0700, Paul E Condon wrote:
> On 20100115_051059, T o n g wrote:
> > Hi,
> >
> > Which tool can help me decode the Unix time? E.g., strings like
> > 1257624539, 1258162046, 1257623988, 1257709563, etc. they are about 68
> > days ago.
> >
> > Thanks
> >
>
> date contains the standard time/date handling code, but it is
> inconvenient to give it a ten digit Unix time number. Where are you
> getting these numbers? I suggest that you change the way you get the

I believe squid logs like that !

> numbers so that they are both human readable and parsable by simple
> code. I like date +%Y%m%d_%H%M%S
>
[snip]
 
Old 01-15-2010, 06:25 AM
Kun Niu
 
Default Decode unixtime

Have you tried the function "ctime"?

Alex Samad wrote:
> On Fri, Jan 15, 2010 at 12:09:33AM -0700, Paul E Condon wrote:
>
>> On 20100115_051059, T o n g wrote:
>>
>>> Hi,
>>>
>>> Which tool can help me decode the Unix time? E.g., strings like
>>> 1257624539, 1258162046, 1257623988, 1257709563, etc. they are about 68
>>> days ago.
>>>
>>> Thanks
>>>
>>>
>> date contains the standard time/date handling code, but it is
>> inconvenient to give it a ten digit Unix time number. Where are you
>> getting these numbers? I suggest that you change the way you get the
>>
>
> I believe squid logs like that !
>
>
>> numbers so that they are both human readable and parsable by simple
>> code. I like date +%Y%m%d_%H%M%S
>>
>>
> [snip]
>


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-15-2010, 06:46 AM
Teemu Likonen
 
Default Decode unixtime

On 2010-01-15 05:20 (UTC), Chris Jackson wrote:

> It's not well documented, but: date -d, with an '@' before it:
>
> chrisj@hercule$ date -d '@1257624539'
> Sat Nov 7 20:08:59 GMT 2009

It's documented quite well in info pages, though:

$ info coreutils "date inv"
$ info coreutils seconds

(Or from Emacs.)

But I guess nobody - except Emacs users - read info pages these days, so
in practice it's not very well documented. :-)

--
Feel free to Cc me your replies
if you want to make sure I'll notice them.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-15-2010, 07:56 AM
Chris Jones
 
Default Decode unixtime

On Fri, Jan 15, 2010 at 02:46:07AM EST, Teemu Likonen wrote:
> On 2010-01-15 05:20 (UTC), Chris Jackson wrote:
>
> > It's not well documented, but: date -d, with an '@' before it:
> >
> > chrisj@hercule$ date -d '@1257624539'
> > Sat Nov 7 20:08:59 GMT 2009
>
> It's documented quite well in info pages, though:
>
> $ info coreutils "date inv"
> $ info coreutils seconds
>
> (Or from Emacs.)
>
> But I guess nobody - except Emacs users - read info pages these days,

And they don't read the man pages either, since the date manual states:

| The full documentation for date is maintained as a Texinfo manual. If the info
| and date programs are properly installed at your site, the command
|
| info date
|
| should give you access to the complete manual.

I don't use Emacs, but for anything longer than a couple of screenfuls,
I find the Texinfo manuals have the edge over the man pages, although it
takes a while to get used to finding your way around.

Besides, I hear that due to licensing restrictions, some of the info
pages are not available from the debian repos. As a result, if you don't
mind tainting your debian system, you need to download them from the GNU
website and install them manually, which is not always straightforward.

I don't know if it still ships with more current versions of debian but
there is a nice replacement to the 'info' browser named 'pinfo' that
provides color highlighting and more user-friendly navigation via hjkl +
<Enter>... hmm, more user-friendly for vimmers, that is.. behaves a bit
more like a text-mode web browser.

> so in practice it's not very well documented. :-)

Well, that's why we have mailing lists.. so we can document the doc :-)

CJ


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-15-2010, 01:29 PM
Celejar
 
Default Decode unixtime

On Fri, 15 Jan 2010 03:56:11 -0500
Chris Jones <cjns1989@gmail.com> wrote:

...

> Besides, I hear that due to licensing restrictions, some of the info
> pages are not available from the debian repos. As a result, if you don't
> mind tainting your debian system, you need to download them from the GNU
> website and install them manually, which is not always straightforward.

I) IIUC, the coreutils info documentation is included with the regular
coreutils package.

II) The licensing restrictions on other GNU documentation sometimes
prevents it from entering main, but IIUC, it's generally available in
non-free - no need to do anything manually. This is Debian, after all!

Celejar
--
foffl.sourceforge.net - Feeds OFFLine, an offline RSS/Atom aggregator
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-15-2010, 08:18 PM
Chris Jones
 
Default Decode unixtime

On Fri, Jan 15, 2010 at 09:29:04AM EST, Celejar wrote:
> On Fri, 15 Jan 2010 03:56:11 -0500
> Chris Jones <cjns1989@gmail.com> wrote:
>
[..]

> it's generally available in non-free - no need to do anything
> manually.

Maybe this has changed, but on lenny, I vaguely remember installing the
bash and grep info pages--among a few more exotic others, from gnu.org
because I couldn't find them anywhere in the repos, non-free included.

> This is Debian, after all!

I was under the impression that non-free was not Debian?

CJ





--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-16-2010, 03:23 AM
Brian Ryans
 
Default Decode unixtime

Quoting Paul E Condon on 2010-01-15 01:09:33:
> I suggest that you change the way you get the numbers so that they are
> both human readable and parsable by simple code. I like date
> +%Y%m%d_%H%M%S

+%F_%T is what I use when spaces aren't desirable in dates. See my
quoting line for a slightly modified example of it. From my experience,
it's equally able to be parsed by software, and (IMO) easier to parse by
wetware.

[#include usDateFormatRant.txt]

--
_
ASCII Ribbon Campaign Against ( ) Brian Ryans
HTML E-mail and V-cards X BrianLRyans@gmail.com
www.asciiribbon.org / GPG Public Key 0xC11213D0
Key Fingerprint: 8B2A 54C4 E275 8CFD 8A7D 5D0B 0AD0 B014 C112 13D0
 

Thread Tools




All times are GMT. The time now is 11:40 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org