| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

Java ビルドタイムスタンプを得る

提供: MyMemoWiki
ナビゲーションに移動 検索に移動

Java ビルドタイムスタンプを得る

Java |

  1. SimpleDateFormat df = (SimpleDateFormat) SimpleDateFormat.getInstance();
  2. df.applyPattern("yyyyMMddHHmmssSSS");
  3.  
  4. String timestamp =
  5. df.format(new Date(new File(getClass()
  6. .getClassLoader()
  7. .getResource(getClass().getCanonicalName().replace('.', '/') + ".class")
  8. .toURI()).lastModified()));
  9. return timestamp;