Random Date format
Hi everyone,
As weird as it can appears, when I call the function new Date() sometimes he gives me date in this format: Mon Jun 21 2010 09:07:09 GMT+0200 and sometimes in this one: 2010-06-21 09:07:09 +0200.
So how can I be sure to get one of these format?
2 Answers
-
Accepted Answer
> t's a shame because I'd like to pass the date in the first format
So use the Date object's built in "get" methods to get said format
http://www.devguru.com/technologies/javascript/10585.asp
-
Okay I get it. When you place it into a string it will be the first format. So the code below:
var now = new Date(); Ti.API.info(now); Ti.API.info(" "+now);
will give:
[INFO] 2010-06-21 09:50:27 +0200 [INFO] Mon Jun 21 2010 09:50:27 GMT+0200 (CEST)
It's a shame because I'd like to pass the date in the first format in an HTTP request (also I have to use a string…)