Re: Parse Unix date !
- From: chas.owens@xxxxxxxxx (Chas. Owens)
- Date: Thu, 29 May 2008 08:58:13 -0400
On Thu, May 29, 2008 at 7:42 AM, AY <techrepository@xxxxxxxxx> wrote:
I'm required to grab some value from table in sybase based on the
timestamp of the file generated in Unix ( solaris ). Time format in
Sybase is say ( Mar 22 2008 10:41:59:662 AM).
I'm able to format the time stamp of the file in this format ( Mar 22
2008 10:41:59 AM) but not the *milliseconds*.
1) Would 'ctime' or 'atime' or 'mtime' return milliseconds as well?
I don't believe so. IIRC, ctime, atime, and mtime are all based on
the number of seconds since the epoch (1970-01-01 00:00:00)
2) If it does how can we Parse the milliseconds?
If I remember right I do something like
UnixDate(ParseDate($fileTimeStamp), "% % %") etc..
I'm not sure what %?? to be used inorder to get *milliseconds*.
You could use
my $d = UnixDate(ParseDate($fileTimeStamp), "%b %d %Y %I:%M:%S:000 %p")
but I (being an old C person) would say
use POSIX qw/strftime/;
my $d = strftime "%b %d %Y %I:%M:%S:000 %p", localtime $timestamp;
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
.
- References:
- Parse Unix date !
- From: Ay
- Parse Unix date !
- Prev by Date: Re: add @INC directory
- Next by Date: RE: difference between FTP and SFTP
- Previous by thread: Parse Unix date !
- Index(es):
Relevant Pages
|