我有点啰嗦,但我会尽量说清楚
I'm bored, so I'm working on a "shoutbox", and I'm a little confused over one thing. I want to get the time that a message is entered, and I want to make sure I'm getting the server time, or at least make sure I'm not getting the local time of the user. I know it doesn't matter, since this thing won't be used by anyone besides me, but I want to be thorough. I've looked around and tested a few things, and I think the only way to do this is to get the milliseconds since January 1, 1970 00:00:00 UTC, since that'd be the same for everyone.
我是这样做的:
var time = new Date();
var time = time.getTime();
这将返回像1294862756114这样的数字。
有没有办法将1294862756114转换为更可读的日期,如DD/MM/YYYY HH:MM:SS?
所以,基本上,我正在寻找JavaScript的等效PHP的date();函数。