简体   繁体   中英

Excel vba - change format of date

I have a column with dates that are stored as dmyyyy. h:mm:ss dmyyyy. h:mm:ss .

And the cell format isn't even date it's general . To use it as a date I need to replace that dot with "" . So I used this code:

Format(Date, "d.m.yyyy h:mm:ss")

But it changed all dates to todays date.

The call of Date returns the current date. You have to use the cell value instead, like Format(Cells(row,column), "dmyyyy h:mm:ss") , after you replaced the dot at the end of the year value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM