从GMT时间格式中删除时间 [英] Remove time from GMT time format

查看:81
本文介绍了从GMT时间格式中删除时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到GMT格式的日期,Fri,18 Oct 2013 11:38:23 GMT。问题是时候搞砸我正在使用的时间表。

I am getting a date that comes in GMT format, Fri, 18 Oct 2013 11:38:23 GMT. The problem is that the time is messing up the timeline that I am using.

除了实际的日期,我该如何取出所有的东西?

How can I strip out everything except for the actual date?

推荐答案

像这样:

var dateString='Mon Jan 12 00:00:00 GMT 2015';
dateString=new Date(dateString).toUTCString();
dateString=dateString.split(' ').slice(0, 4).join(' ')
console.log(dateString);

这篇关于从GMT时间格式中删除时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆