os.date(%F) making Win Simulator to crash

I was following the tutorial  https://coronalabs.com/blog/2013/01/15/working-with-time-and-dates-in-corona/

and I noticed that the command os.date("%FT%X%z")  is making the Corona Windows Simulator to crash.

In fact, I didn’t find the %F as a valid command according to the http://docs.coronalabs.com/api/library/os/date.html

%F is the same as %Y-%m-%d.   There are differences between Windows and the other three (iOS, OS-X and Android) that are Unix/Linux based.  os.date is a wrapper around the ‘C’ function strftime() and on Window’s this has to be hacked to deal with the fact that Windows handles dates/times differently than Unix does.  This Stack Overflow post does a good job of explaining it:

http://stackoverflow.com/questions/2034242/date-and-strftime-not-same-on-windows-and-linux-why

In particular the 2nd Answer provides links to what works on Windows and what should work on most Unix machines.

Rob

Thanks for the answer Rob.

I noticed that you mentioned about the Unix system in the blog post, but If I can add more explicit note about not working on Windows on that blog post (for future reference) would be great. (specially because it crashes the simulator, making it hard to identify the root cause of the problem).

I already added a comment on the post.

Best

Renato

I’ll update the blog post with the longer form of the date string.

Rob

Yes, that works also.

Just another comment: on Windows Simulator the %z param would output the timezone name (as described in the docs) and not the timezone hours difference.

%F is the same as %Y-%m-%d.   There are differences between Windows and the other three (iOS, OS-X and Android) that are Unix/Linux based.  os.date is a wrapper around the ‘C’ function strftime() and on Window’s this has to be hacked to deal with the fact that Windows handles dates/times differently than Unix does.  This Stack Overflow post does a good job of explaining it:

http://stackoverflow.com/questions/2034242/date-and-strftime-not-same-on-windows-and-linux-why

In particular the 2nd Answer provides links to what works on Windows and what should work on most Unix machines.

Rob

Thanks for the answer Rob.

I noticed that you mentioned about the Unix system in the blog post, but If I can add more explicit note about not working on Windows on that blog post (for future reference) would be great. (specially because it crashes the simulator, making it hard to identify the root cause of the problem).

I already added a comment on the post.

Best

Renato

I’ll update the blog post with the longer form of the date string.

Rob

Yes, that works also.

Just another comment: on Windows Simulator the %z param would output the timezone name (as described in the docs) and not the timezone hours difference.