Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 49767
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: dmuey [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: [is there/can we add] a CLDR equiv for %s/%{epoch}
Hello again, Last one I promise :) Just FYI: I am filing this rt under DateTime::Locale instead DateTime since ::Locale specifies formats, let me know if I should re-file under DateTime (or if this simply won't be implemented), thanks. strftime() has %s for 'The number of seconds since the epoch.' Also it supported %{epoch} to have it call the DT method "epoch". I can't seem to find an equivalent way to do 'The number of seconds since the epoch.' with format_cldr() $ perl -MDateTime -le 'print DateTime->now()->strftime("%B %{day}, %Y %{hour_12}:%M:%S %p %{time_zone_long_name} == %s");' September 16, 2009 6:24:23 PM UTC == 1253125463 $ perl -MDateTime -le 'print DateTime->now()->strftime("%B %{day}, %Y %{hour_12}:%M:%S %p %{time_zone_long_name} == %{epoch}");' September 16, 2009 6:24:33 PM UTC == 1253125473 $ perl -MDateTime -le 'print DateTime->now()->format_cldr("MMMM d, y h:mm:ss a z == ???");' September 16, 2009 6:24:40 PM UTC == ??? Is a CLDR %s equivalent currently available and I just missed it? (If so what did I miss?) If not: how [im]possible/[un]likley is it to be added?
Show quoted text
> Also it supported %{epoch} to have it call the DT method "epoch".
I think supporting something like this in the CLDR output would be nice but I haven't come up with anything that I think fits in with the CLDR style. If you have any ideas please send them to datetime@perl.org.
I've looked at this several times over the years and I've come to the conclusion that there's no good way to do this. CLDR just uses random letters as formats, so there's no good way to allow method names in the format. It's not that terrible to write: $dt->format_cldr('MMM') . $dt->method