Date in Unix format


#1

Hi,
I am using RT on RH Linux 6.2.
The date stored in the RT database is in UNIX format…like 968498838.
I need to convert this in normal dd/mm/yyyy format.
Can somebody please suggest how to get around with this.
Thanks in advance.
reg
sandeep


#2

perl -MCPAN -e 'install Date::Format’
man Date::FormatOn Mon, Sep 25, 2000 at 03:20:42PM +0530, SandeepPeriwal wrote:

Hi,
I am using RT on RH Linux 6.2.
The date stored in the RT database is in UNIX format…like 968498838.
I need to convert this in normal dd/mm/yyyy format.
Can somebody please suggest how to get around with this.
Thanks in advance.
reg
sandeep


Rt-devel mailing list
Rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

meow
_ivan


#3

Under mysql, the FROM_UNIXTIME paramater will return the format in human
readable form. i.e.
select FROM_UNIXTIME(date_created) from rt.each_req

You can adjust the format with the same parameters as DATE_FORMAT (see mysql
docs at http://www.mysql.com)

John>>>>> On Mon, 25 Sep 2000, “SandeepPeriwal” == SandeepPeriwal wrote:

SandeepPeriwal> Hi, I am using RT on RH Linux 6.2. The date stored in the
SandeepPeriwal> RT database is in UNIX format…like 968498838. I need to
SandeepPeriwal> convert this in normal dd/mm/yyyy format. Can somebody
SandeepPeriwal> please suggest how to get around with this. Thanks in
SandeepPeriwal> advance. reg sandeep

SandeepPeriwal> _____________________________________________________________
SandeepPeriwal> Rt-devel mailing list Rt-devel@lists.fsck.com
SandeepPeriwal> http://lists.fsck.com/mailman/listinfo/rt-devel


#4

Hi,

FWIW, I prefer

use POSIX qw(strftime);
my $nicedate = strftime("%d/%m/%Y", localtime($unixtime));

or

$nicedate = POSIX::strftime("%d/%m/%Y", localtime($unixtime));

Advantage: uses core perl; no need to install extra modules
(important if you can’t modify your local perl installation, for
whatever reason). Aside: I also like POSIX::tmpnam() vs some
unholy amalgam of $$ and time() if only because I can blame a
standards committee (or Sun) if my code blows up…

Date::Manip is a weighty sledgehammer but very nice if you’re not
converting, say, a million timestamps from webserver logs :slight_smile:

TMTOWTDI,

– BobOn 25 Sep 00, at 3:10, ivan wrote:

perl -MCPAN -e 'install Date::Format’
man Date::Format

On Mon, Sep 25, 2000 at 03:20:42PM +0530, SandeepPeriwal wrote:

Hi,
I am using RT on RH Linux 6.2.
The date stored in the RT database is in UNIX format…like
968498838. I need to convert this in normal dd/mm/yyyy format. Can
somebody please suggest how to get around with this. Thanks in
advance. reg sandeep


Rt-devel mailing list
Rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel


meow
_ivan


Rt-devel mailing list
Rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel


#5

arclight@jump.net writes:

Aside: I also like POSIX::tmpnam() vs some unholy amalgam of $$ and
time() if only because I can blame a standards committee (or Sun) if
my code blows up…

To go further afield, this method (or using IO::File->new_tmpfile()
which is another interface to the same thing) is better because it, in
theory, produces non-predictable filenames. This is pretty crucial for
security purposes. The “in theory” part is in my statement because not
all operating systems produce good random names. For example, SunOS
4.x has a lousy implementation of tmpfile.

If you want to be even spiffier in this regard, later version of Perl
(the 5.7.0 track) will be shipping with File::Temp which attempts to
do the “right thing” even when the operating system does not.

For more information on File::Temp and temporary files, see:

http://search.cpan.org/search?mode=module&query=File%3A%3ATemp

Hope this diversion is helpful to the RT developers and other folks.
Peace,
dNb


#6

nod Once I get a moment, we’ll probably require File::Temp and start using
it for all our tempfiles.On Wed, Sep 27, 2000 at 01:46:50PM -0400, David N. Blank-Edelman wrote:

arclight@jump.net writes:

Aside: I also like POSIX::tmpnam() vs some unholy amalgam of $$ and
time() if only because I can blame a standards committee (or Sun) if
my code blows up…

To go further afield, this method (or using IO::File->new_tmpfile()
which is another interface to the same thing) is better because it, in
theory, produces non-predictable filenames. This is pretty crucial for
security purposes. The “in theory” part is in my statement because not
all operating systems produce good random names. For example, SunOS
4.x has a lousy implementation of tmpfile.

If you want to be even spiffier in this regard, later version of Perl
(the 5.7.0 track) will be shipping with File::Temp which attempts to
do the “right thing” even when the operating system does not.

For more information on File::Temp and temporary files, see:

http://search.cpan.org/search?mode=module&query=File%3A%3ATemp

Hope this diversion is helpful to the RT developers and other folks.
Peace,
dNb


Rt-devel mailing list
Rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

jesse reed vincent — root@eruditorum.orgjesse@fsck.com
pgp keyprint: 50 41 9C 03 D0 BC BC C8 2C B9 77 26 6F E1 EB 91
"Mary had a crypto key / She kept it in escrow
And everything that Mary said / The Feds were sure to know" – Sam Simpson