删除长日期格式的时间元素 [英] Removing time element of Long Date Format

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

问题描述

我在过去三年内有一个数据清单,但所有的日期都有不同的时间。我正在尝试编写一个将删除所有时间的宏。我尝试更改单元格的格式,但它没有工作。

I have a list of data within the last three years, but all the dates have different times on it. I am trying to write a macro that will delete all the times. I tried changing the format of the cell but it didn't work.

EX。列表如下所示:

EX. the list looks like:


10/12/2011 08:41 PM Eastern Time
10/12/2011 08:41 PM Eastern Time
10/12/2011 08:41 PM Eastern Time
10/12/2011 08:41 PM Eastern Time
10/12/2011 08:41 PM Eastern Time
10/12/2011 08:41 PM Eastern Time
10/12/2011 08:41 PM Eastern Time
10/12/2011 08:41 PM Eastern Time

我需要删除每个东部时间的$ code> 08:41 PM或等价物。所有的时代都是不同的。任何想法?

And I need to delete the 08:41 PM Eastern Time or equivalent from each. All the times are different though. Any thoughts?

推荐答案

如果实际的日期格式,尝试 = INT(A1)然后格式适合。

If actually date format, try =INT(A1) then format to suit.

这应该涵盖文本或时间格式:

This should cover either text or time format:

=IF(CELL("type",A1)="l",LEFT(A1,FIND(" ",A1)),INT(A1))  

甚至:

=TEXT(IF(CELL("type",A1)="l",LEFT(A1,FIND(" ",A1)),INT(A1)),"mm/dd/yyyy")  

如果输出格式为mm / dd / yyyy。

if the output is to be formatted mm/dd/yyyy.

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

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