vba - Convert 24 hour Clock to 12 hour clock and add 6 hours -


i have infinite rows with single column assigned define date , time in following 'general format' "2016.08.10 06:00:00.066". aware can't convert every single cell in column "mm/dd/yyyy hh:mm:ss.000 am/pm". therefore single column assigned "mm/dd/yyyy" , column assigned "hh:mm:ss.000 am/pm". time 6 hours behind add 6 hours it. struggling although cells in general or text format time , date being displayed "yyyy.mm.dd hh:mm:ss.000". , can't find way split 2 in format appreciated

to convert text format excel change data/time use this:

=--substitute(substitute(a1,".","/",1),".","/",1) 

then add 6 hours use:

+ time(6,0,0) 

so date/time is:

=--substitute(substitute(a1,".","/",1),".","/",1) + time(6,0,0) 

then format new cell:

mm/dd/yyyy hh:mm:ss.000 am/pm 

you can split date , time:

date:

=int(--substitute(substitute(a1,".","/",1),".","/",1) + time(6,0,0)) 

and format mm/dd/yyyy

time:

=mod(--substitute(substitute(a1,".","/",1),".","/",1) + time(6,0,0)),1) 

and format hh:mm:ss.000 am/pm

enter image description here


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -