在notepad++中添加特殊字符/excel

Add special characther in notepad++/excel

我需要像这样替换字符串: 20211201153000

像这样的日期格式

2021/12/01 15:30:00 (yyyy/MM/GG hh:mm:ss)

有什么解决办法吗?

使用 CONCAT 和 MID:

=CONCAT(MID(A1,{1,5,7,9,11,13},{4,2,2,2,2,2})&{"/","/"," ",":",":",""})

上面returns一个看起来像日期的字符串。要创建一个真正的日期,请使用双一元:

=--CONCAT(MID(A1,{1,5,7,9,11,13},{4,2,2,2,2,2})&{"/","/"," ",":",":",""})

并根据需要格式化输出。

另一种选择,仅使用文本功能

1] 在B2中输入公式:

=TEXT(A2,"0000\/00\/00\ 00\:00\:00")

或者,

2]将单元格转换为日期格式,在B3公式中变为:

=0+TEXT(A3,"0000\/00\/00\ 00\:00\:00")

自定义单元格格式为:dd/mm/yyyy h:mm:ss

使用记事本++:

  • Ctrl+H
  • 查找内容:(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)
  • 替换为:// ::
  • 检查 环绕
  • 检查 正则表达式
  • 全部替换

解释:

(\d\d\d\d)      # group 1, 4 digit. You can use \d{4}. year
(\d\d)          # group 2, 2 digit. month
(\d\d)          # group 3, 2 digit. day
(\d\d)          # group 4, 2 digit. hour
(\d\d)          # group 5, 2 digit. minute
(\d\d)          # group 6, 2 digit. second

替换:

          # content of group1. year
/           # slash
          # content of group2 month
/           # slash
          # content of group 3. day
            # a space
          # content of group 4. hour
:           # colon
          # content of group 5. minute
:           # colon
          # content of group 6. second

截图(之前):

截图(后):