I remember this working the last time I tried, but I wouldn't venture a guess when it stopped working.
Example:
[code]
./gpg2 --full-gen-key
gpg (GnuPG) 2.1.20; Copyright (C) 2017 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) 20191231T235959
Key expires at Tue Dec 31 15:59:59 2019 PST
Is this correct? (y/N)
[/code]
The correct output should be "Key expires at Tue Dec 31 23:59:59 2019 PST"
This feature is not documented at all in the user guides but I've been using it for years. It's documented in the source code, but not very well. It looks to me that the first character after the "T" is being ignored. This format (no punctuation and a "T" separating the date and time) is the only format that can be used to specify a time. To specify a date with no time, YYYY-MM-DD can be used.