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")
If the result is requirde in VBA:
strFormatYouWant = "yyyymmdd" 'or any valid date format
strDt = format(range("a2"), strFormatYouWant)
Otherwise, see @brettdj's reply
精彩评论