vba - Convert TZ data in Excel -


i'm using excel display time stamps log file. time stamps in raw output of file displayed millisecond precision, need maintain. time stamps in utc, need convert local timezone. when use dateadd function convert tz offset, sets millisecond value '000'.

getlocaltimefromgmt = dateadd("h", offset, datetoconvert) 

is there way use dateadd without losing precision, or there function better suited task?

please check below link more details.

http://www.cpearson.com/excel/timezoneanddaylighttime.aspx

function getlocaltimefromgmt(optional gmttime date) date     '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''     ' getlocaltimefromgmt     ' returns local time gmt time. if gmttime present ,     ' greater 0, assumed gmt calculate     ' local time. if gmttime 0 or omitted, assumed gmt     ' time.     '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''     dim gmt date     dim tzi time_zone_information     dim dst time_zone     dim localtime date      if starttime <= 0         gmt =     else         gmt = gmttime     end if     dst = gettimezoneinformation(tzi)     localtime = gmt - timeserial(0, tzi.bias, 0) + iif(dst = time_zone_daylight, timeserial(1, 0, 0), 0)     getlocaltimefromgmt = localtime      end function 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -