lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Aug 17, 2008 at 9:10 AM, Pete Kay <petedao@gmail.com> wrote:
Hi,
 
Is there anyway to generate the current date and current time given the time zone?
 
 
Thank you in advance for your help. Any help will be greatly appreciated.
 
 
Regards,
Pete

You can use ! in a format string to os.date, and get the current UTC date/timestamp and then make your adjustements from there.  For example:

> = os.date("!%c")
Sun Aug 17 08:59:22 2008

Of course you can do the same when requesting a time table, as in:

> os.date("!*t")