Sorry, this entry is only available in Japanese.
Here is the way to get current year, month, day, hour, minute and second in PostgreSQL.
Here’s a tips to connect PostgreSQL in VirtualBox guest OS, from Windows. The article suppose host OS is Windows, but theoretically it is also the same way in other host OS.
I will introduce you several way to output sql result into a file with using psql.