Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: strftime reference

by Anonymous Monk
on Feb 28, 2005 at 11:03 UTC ( #435014=note: print w/replies, xml ) Need Help??


in reply to strftime reference for Win32

The reason that POSIX manual doesn't show the list of escape sequences is that the list depends on your OS. Perhaps you should make it more clear that your program is only of use for Windows users - on my system, I also have:
  • %C: Century number (2 digits)
  • %D: equivalent to %m/%d/%y
  • %e: like %e, leading zero of month replaced with space
  • %E: Modifier alternative format
  • %F: Equivalent to %Y-%m-%d
  • %g: Like %G, but use 2-digit year
  • %G: 4 digit year, but if ISO week belongs to previous year, use previous year.
  • %g: Like %G, but use 2-digit year
  • %h: Equivalent to %b
  • %k: Hours, 0 - 23, single digits preceeded by blank
  • %l: Hours, 1 - 12, single digits preceeded by blank
  • %n: Newline
  • %O: Modifier alternative format
  • %P: As %p, but in lowercase
  • %r: Equivalent to '%I:%M:%S %p'
  • %R: Equivalent to '%H:%M'
  • %s: Number of seconds since epoch
  • %t: Tab character
  • %T: Equivalent to '%H:%M:%S'.
  • %u: Day of week, 1 (Monday) - 7 (Sunday)
  • %V: ISO week number of the year (01 - 53)
  • %z: Time zone as offset of GMT.
  • %%: A % character
  • %+: Time in 'date' format
Here's a program to see what's available on your OS:
#!/usr/bin/perl use strict; use warnings; use POSIX; foreach my $ch ('a' .. 'z', '%', '+') { my $lc = strftime "%\l$ch", localtime; my $uc = strftime "%\u$ch", localtime; for ($lc, $uc) { s/\n/\\n/g; s/\t/\\t/g; } printf "%%%s %25s %25s\n", lc $ch, $lc, $uc; } __END__

Replies are listed 'Best First'.
Re^2: strftime reference
by holli (Monsignor) on Feb 28, 2005 at 14:02 UTC
    I was not aware of that. Thanks for the info, i retitled the node.


    holli, /regexed monk/

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://435014]
help
Chatterbox?
Corion had a meeting with some startup today. They have a very interesting DB proxy product, but their tech stack is really, really weird. They use the Pg wire protocol but not the Pg libraries to handle it. They support Pg SQL syntax, but don't use ...
[Corion]: ... the Pg parser (or so they claim).
[Corion]: Also, they rolled their own user management instead of supporting LDAP for user/role management, but that just shows that they're new in the enterprise market :)
Corion also just now realizes they didn't leave business cards.
[erix]: can you drop a name? :)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (13)
As of 2018-04-19 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?