Question: So we had the Discussion today in our company about `+new Date()` being good practice or not.
Some prefer this way over `new Date().getTime()`.

In my opinion, this is pretty convenient but on the other side one would say it's harder to read.

Are there any pros or cons besides the obvious "It's harder to understand for people not familiar with the unary operator"?

Answer: 
The `getTime` method appears to be a [huge amount faster](http://jsperf.com/get-time-vs-unary-plus):

![enter image description here](https://i.stack.imgur.com/Fz4y9.png)

**Why is this the case?**

Here's what happens when you call the `getTime` method on a `Date` instance:

1. Return the value of the [`[[PrimitiveValue]]`](http://es5.github.com/#x15.9.3.2) internal property of this Date object.

Here's what happens when you apply the unary plus operator to a `Date` instance:

1. [Get the value](http://es5.github.com/#x8.7.1) of the `Date` instance in question
2. [Convert it to a Number](http://es5.github.com/#x9.3)
	1. [Convert it to a primitive](http://es5.github.com/#x9.1)
		1. Call the internal [`[[DefaultValue]]`](http://es5.github.com/#x8.12.8) method
I find that this type of code tends to often be called infrequently, so I thought it best to add tests for the inline usage you typically see:

e.g.

```
var t = (new Date()).getTime();

```

and

```
var t = +new Date();

```

The JSPerf results show these two are not much different in speed: <http://jsperf.com/get-time-vs-unary-plus/7>

![enter image description here](https://i.stack.imgur.com/UHE4B.png)

The problem with the previous perf results are that the example is not practical. You would not keep getting the same `now` in practice. You would just store the `getTime()` result once if the now was not changing. As these new results show, the speed difference is not significant in the typical usage situation.

So I guess the general advice is, use either for one-off usage `+new Date()` being shorter, but `(new Date()).getTime()` is more readable (and a tad faster).

Date.now():
-----------

If you are going to use the newer `Date.now()`, you will want to implement the recommended shim to support older browsers from [here](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/now) 

```
if (!Date.now) {
  Date.now = function now() {
    return new Date().getTime();
  };
}

```

*(Although I am puzzled why they don't just use an anonymous function in that example)*