Mailing List Archive

time and convert_date oddities
I was noticing some differences of using "%X" in the below, and found an
additional head scratcher.

Test code:
[time fmt="%X"]<br />
[convert_date fmt="%X"][time fmt="%Y-%m-%d %H:%M:%S"][/convert_date]
[convert_date fmt="%X"]2011-08-07 12:34:56[/convert_date]

Produces this:
02:51:44
02:51:00 AM
12:34:00 PM

The first thing I notice is that AM/PM is added when using convert_date, and
the docs don't show %X as outputting this. The second thing I notice is that
the seconds place is always 00 for convert_date. I don't need the seconds in
this case, I'm just trying to be complete in my observations.

Are these expected, bugs, or am I misunderstanding some usage?

Paul


_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: time and convert_date oddities [ In reply to ]
Quoting Paul Jordan (paul@gishnetwork.com):
>
> I was noticing some differences of using "%X" in the below, and
> found an additional head scratcher.
>
> Test code:
> [time fmt="%X"]<br />
> [convert_date fmt="%X"][time fmt="%Y-%m-%d %H:%M:%S"][/convert_date]
> [convert_date fmt="%X"]2011-08-07 12:34:56[/convert_date]
>
> Produces this:
> 02:51:44
> 02:51:00 AM
> 12:34:00 PM
>
> The first thing I notice is that AM/PM is added when using
> convert_date, and the docs don't show %X as outputting this. The
> second thing I notice is that the seconds place is always 00 for
> convert_date. I don't need the seconds in this case, I'm just trying
> to be complete in my observations.
>
> Are these expected, bugs, or am I misunderstanding some usage?

What I don't understand is why you want to use %X. It's behavior
is indeterminate as far as Interchange or Perl is concerned -- it's
the OS doing what it does.

--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.328.4479 <mike@perusion.com>

The problem with Internet quotations is that many of them
are not genuine. -- Abraham Lincoln

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: time and convert_date oddities [ In reply to ]
> Mike says...> Quoting Paul Jordan (paul@gishnetwork.com):
> >
> > I was noticing some differences of using "%X" in the below, and
> > found an additional head scratcher.
> >
> > Test code:
> > [time fmt="%X"]<br />
> > [convert_date fmt="%X"][time fmt="%Y-%m-%d %H:%M:%S"][/convert_date]
> > [convert_date fmt="%X"]2011-08-07 12:34:56[/convert_date]
> >
> > Produces this:
> > 02:51:44
> > 02:51:00 AM
> > 12:34:00 PM
> >
> > The first thing I notice is that AM/PM is added when using
> > convert_date, and the docs don't show %X as outputting this. The
> > second thing I notice is that the seconds place is always 00 for
> > convert_date. I don't need the seconds in this case, I'm just trying
> > to be complete in my observations.
> >
> > Are these expected, bugs, or am I misunderstanding some usage?
>
> What I don't understand is why you want to use %X. It's behavior
> is indeterminate as far as Interchange or Perl is concerned -- it's
> the OS doing what it does.
I just thought I could use it in formatting dates and times as per: http://docs.icdevgroup.org/cgi-bin/online/glossary/time.html I had to abandon it because I needed something more reliable like %H:%M:%S. Paul
Re: time and convert_date oddities [ In reply to ]
Quoting Paul Jordan (paul@gishnetwork.com):
> > Mike says...
> > Quoting Paul Jordan (paul@gishnetwork.com):
> > >
> > > I was noticing some differences of using "%X" in the below, and
> > > found an additional head scratcher.
> > >
> > > Test code:
> > > [time fmt="%X"]<br />
> > > [convert_date fmt="%X"][time fmt="%Y-%m-%d
> %H:%M:%S"][/convert_date]
> > > [convert_date fmt="%X"]2011-08-07 12:34:56[/convert_date]
> > >
> > > Produces this:
> > > 02:51:44
> > > 02:51:00 AM
> > > 12:34:00 PM
> > >
> > > The first thing I notice is that AM/PM is added when using
> > > convert_date, and the docs don't show %X as outputting this. The
> > > second thing I notice is that the seconds place is always 00 for
> > > convert_date. I don't need the seconds in this case, I'm just
> trying
> > > to be complete in my observations.
> > >
> > > Are these expected, bugs, or am I misunderstanding some usage?
> >
> > What I don't understand is why you want to use %X. It's behavior
> > is indeterminate as far as Interchange or Perl is concerned -- it's
> > the OS doing what it does.
>
> I just thought I could use it in formatting dates and times as per:
>
> [1]http://docs.icdevgroup.org/cgi-bin/online/glossary/time.html
>
> I had to abandon it because I needed something more reliable
> like %H:%M:%S.

The docs should really say

see strftime(3) for authoritative information

The real definition of %X is:

%X The preferred time representation for the current locale without the date.

--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.328.4479 <mike@perusion.com>

Life isn't fair, but it's good. -- Regina Brett

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users