# %P specifier in format\_time/3 produces no output in Windows

**URL:** https://swi-prolog.discourse.group/t/p-specifier-in-format-time-3-produces-no-output-in-windows/4361
**Category:** General
**Tags:** bug
**Created:** [September 1, 2021, 3:05am UTC](https://swi-prolog.discourse.group/t/p-specifier-in-format-time-3-produces-no-output-in-windows/4361 "2021-09-01T03:05:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mike.elston](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mike.elston/32/3691_2.png) [@mike.elston](https://swi-prolog.discourse.group/u/mike.elston)
#### Post date: [September 1, 2021, 3:05am UTC](https://swi-prolog.discourse.group/t/p-specifier-in-format-time-3-produces-no-output-in-windows/4361/1 "2021-09-01T03:05:35Z")

</div>

According to [SWI-Prolog -- Manual](https://www.swi-prolog.org/pldoc/man?section=datimepreds)

`P`  
Like %p but in lowercase:‘am’ or‘pm’ or a corresponding string for the current locale

```prolog
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.28-30-g2e1beb082)

?- get_time(T),format_time(current_output,'%l%P',T).
 2
T = 1630464840.170424.

```

but lowercase p works ok (well in Windows in New Zeland it gives lowercase am/pm but that’s another story)

```prolog
?- get_time(T),format_time(current_output,'%l%p',T).
 2pm
T = 1630464833.699506.

```

%P works correctly in Linux:

```prolog
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.28)

?- get_time(T),format_time(current_output,'%l%P',T).
 3pm
T = 1630465445.4049911.

```

---

<div class="post-metadata">

### Author: ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)
#### Post date: [September 1, 2021, 8:34am UTC](https://swi-prolog.discourse.group/t/p-specifier-in-format-time-3-produces-no-output-in-windows/4361/2 "2021-09-01T08:34:48Z")

</div>

It turns out that `%P` is a glibc extension of the strftime() call. As it is easy enough to emulate using %p and case conversion I’ve pushed a patch that makes `%P` work on all platforms. Most likely there are more platform discrepancies because strftime() doesn’t seem to be very well standardized ☹
