开发者

In excel, I have a cell that in dd/mm/yyyy hh:mm format, i want to extract date as a string

开发者 https://www.devze.com 2023-04-12 01:21 出处:网络
I have a cell that has date time in the following format. dd/mm/yyyy hh:mm. Now i need to extract the date out of it as a stri开发者_Go百科ng and append to it a different time. And i need the final re

I have a cell that has date time in the following format. dd/mm/yyyy hh:mm. Now i need to extract the date out of it as a stri开发者_Go百科ng and append to it a different time. And i need the final result as a string. Whats the best way to do this.?


If your date/time was in A1, your second time in A2 then in A3

=TEXT(A1,"dd-mm-yyyy")&" " &TEXT(A2,"hh:mm")

In excel, I have a cell that in dd/mm/yyyy hh:mm format, i want to extract date as a string


If the result is requirde in VBA:

strFormatYouWant = "yyyymmdd"  'or any valid date format
strDt = format(range("a2"), strFormatYouWant)

Otherwise, see @brettdj's reply

0

精彩评论

暂无评论...
验证码 换一张
取 消