信念樹(shù)下
          --夢(mèng)想只是不能實(shí)現(xiàn)的,想要實(shí)現(xiàn)就要有計(jì)劃。
          posts - 5,comments - 0,trackbacks - 0
           1import java.util.TimeZone;
           2import java.util.Date;
           3import java.text.DateFormat;
           4
           5public class ForTest {
           6
           7public static void main(String[] args) {
           8
           9DateFormat dateFormatterChina = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM);//格式化輸出
          10TimeZone timeZoneChina = TimeZone.getTimeZone("Asia/Shanghai");//獲取時(shí)區(qū)
          11dateFormatterChina.setTimeZone(timeZoneChina);//設(shè)置系統(tǒng)時(shí)區(qū)
          12Date curDate = new Date();//獲取系統(tǒng)時(shí)間
          13
          14System.out.println(dateFormatterChina.format(curDate));
          15}

          16}
           
          正常情況下會(huì)與本機(jī)時(shí)間相差8小時(shí),原因是注冊(cè)表里面的時(shí)區(qū)設(shè)置問(wèn)題。
          解決:
          找到原有的注冊(cè)表并修改對(duì)應(yīng)的地方
          [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\China Standard Time]
          “Display“=“(GMT+08:00) 北京,重慶,香港特別行政區(qū),烏魯木齊“
          “Dlt“=“中國(guó)夏季時(shí)間“
          “Std“=“中國(guó)標(biāo)準(zhǔn)時(shí)間“
          “MapID“=“-1,75“
          “Index“=dword:000000d2
          “TZI“=hex:20,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,\
          00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
          posted on 2010-10-25 21:01 三角形 閱讀(796) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 容城县| 大城县| 界首市| 庆城县| 湟源县| 定日县| 沙洋县| 安岳县| 明水县| 南雄市| 江津市| 宝兴县| 盐亭县| 大足县| 治县。| 安仁县| 德阳市| 舞钢市| 珠海市| 钟祥市| 广宁县| 龙井市| 西乌珠穆沁旗| 古田县| 稷山县| 刚察县| 济源市| 化德县| 云南省| 牙克石市| 天镇县| 锦屏县| 昔阳县| 四会市| 高尔夫| 吴桥县| 上蔡县| 武城县| 玉溪市| 晋州市| 彩票|