From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: fee84,8472dae0dfdcba15 X-Google-Attributes: gidfee84,public From: Boyd Adamson Subject: Re: timestamp (unix time) Date: 1998/12/03 Message-ID: <3665F0A9.E7A286CC@usa.net>#1/1 X-Deja-AN: 418071793 Content-Transfer-Encoding: 8bit References: <7437b5$a86@globo.edinfor.pt> <366542CE.7893@pstcc.cc.tn.us.net> <743p02$8ps1@globo.edinfor.pt> To: Pedro Nobre Content-Type: text/plain; charset=iso-8859-1 Organization: OzEmail Ltd. Mime-Version: 1.0 Newsgroups: comp.unix.osf.osf1 Pedro Nobre wrote: > > Thanks, but that isn�t realy what i�m looking for. > You are write, i'm making a shell script, but let me explain it better: > Unix stores date in a long integer that represents the number of seconds > since Jan,1,1970. > What i pretend is something that decodes a number, say "912614795", to a > date "02-12-1998 16:05:31" corresponding to that number. > > Pedro Sounds like what you need is a program called unixSex, written by one of my colleagues. It will convert from time_t values (seconds from the epoch) to and from a date string, allowing you to specify a format string so the date can be in whatever format you want. Since you don't have a compiler, I can mail you an executable if you like. For example: titan:~$ unixSex -h Usage: To print seconds since the Epoch (01/01/1970) to stdout: unixSex To print seconds since the Epoch for a date string to stdout (default fmt-string: "%Y%m%d%H%M%S"; use %b, %B, %d, %H, %m, %M, %S, %y or %Y): unixSex "[date-str]" "[fmt-string]" The reverse: print time string (like output from 'date') to stdout: unixSex -v [seconds-since-Epoch] Same as the previous, allowing user-defined format (see 'man strftime'): unixSex -v [seconds-since-Epoch] "[fmt-string]" titan:~$ unixSex 912646323 titan:~$ unixSex -v 912646323 Thu Dec 03 10:52:03 AEST 1998 Or, more specifically to your question: titan:~$ unixSex -v 912614795 "%d-%m-%Y %H:%M:%S" 03-12-1998 02:06:35 titan:~$ Heh... I guess we're in different timezones. titan:~$ TZ=:GMT unixSex -v 912614795 "%d-%m-%Y %H:%M:%S" 02-12-1998 16:06:35 titan:~$ Boyd --