In most systems (ie, POSIX), os.date("%X",0)
gives you the time of the epoch, which is 00:00:00 (Coordinated Universal Time, UTC), 1 January 1970.
You get 20:00:00
because you're in a different time zone.
To force UTC instead of your time zone, start the format with !
. This is mentioned in the manual.
So, use os.date("!%X",0)
to get 00:00:00
as desired. It'll work with any number of seconds less than a day (86400). For instance, os.date("!%X",70)
gives 00:01:10
: 1 minute and 10 seconds.