Skip to content

Instantly share code, notes, and snippets.

@mattn
Created January 11, 2012 06:20
Show Gist options
  • Save mattn/1593343 to your computer and use it in GitHub Desktop.
Save mattn/1593343 to your computer and use it in GitHub Desktop.
let s:reg_path = 'HKLM\System\CurrentControlSet\Control\TimeZoneInformation'
function! s:GetTimeZoneName()
let res = system(printf("reg query %s /v StandardName | findstr REG_SZ", s:reg_path))
return split(substitute(res, '\n', '', 'g'), '\s')[2]
endfunction
function! s:GetTimeZoneOffset()
let res = system(printf("reg query %s /v Bias | findstr REG_DWORD", s:reg_path))
return -(split(res, '[ \t\n]\+')[2] / 60)
endfunction
"echo s:GetTimeZoneName()
"echo s:GetTimeZoneOffset()
@h-east
Copy link

h-east commented Jan 11, 2012

You Cool!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment