Re: Parse Unix date !



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.
.



Relevant Pages

  • Re: Date/Time control panel
    ... Everything works pretty well on my English build of XPProEmulation. ... both OSes - XP Pro and XPProEmulation. ... I don't have any good suggestion rather then monitoring the system with Regmon/Filemon while you are changing the time format. ...
    (microsoft.public.windowsxp.embedded)
  • Re: 24-hour vs am/pm time format
    ... time format despite the fact I'm using the 24-hour format as the default in ... Entourage will use your Mac's system settings. ... You most likely have gone into the Date & Time System Preferences pane ... time format in a field at the top. ...
    (microsoft.public.mac.office.entourage)
  • Re: 24-hour vs am/pm time format
    ... time format despite the fact I'm using the 24-hour format as the default in ... Entourage will use your Mac's system settings. ... You most likely have gone into the Date & Time System Preferences pane ... time format in a field at the top. ...
    (microsoft.public.mac.office.entourage)
  • Re: Another Days, Hours, Minutes, Question
    ... address Hours, Days, with or w/o weekends, holiday, work hours, or work days, ... Below is an example of a small spreadsheet used to capture equipment runtime ... -- 24 hour time format ... First of all, your result will have to be a text string, as the dd format will ...
    (microsoft.public.excel.programming)
  • DateTime Formatting
    ... Control Panel to HH:MM:SS as I prefer 24 hour time format to 12+AMPM. ... have DateTime fields in my Delphi app and format them using LongTimeFormat ...
    (alt.comp.lang.borland-delphi)