Java Code Examples for java.text.SimpleDateFormat#getInstance()

The following examples show how to use java.text.SimpleDateFormat#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TakePhotoPresenter.java    From umeng_community_android with MIT License 6 votes vote down vote up
/**
 * Creates the image file to which the image must be saved.
 * 
 * @return
 * @throws IOException
 */
private File createImageFile() throws IOException {
    SimpleDateFormat dateFormat = (SimpleDateFormat) SimpleDateFormat.getInstance();
    dateFormat.applyPattern("yyyyMMdd_HHmmss");
    String timeStamp = dateFormat.format(new Date());
    String imageFileName = "JPEG_" + timeStamp + "_";
    File storageDir = Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_PICTURES);
    // 检测目录是否存在
    if (!storageDir.exists()) {
        storageDir.mkdirs();
    }
    File image = File.createTempFile(imageFileName, ".jpg", storageDir);

    mNewImagePath = image.getAbsolutePath();
    return image;
}
 
Example 2
Source File: FactoryExampleTest.java    From algorithms with MIT License 4 votes vote down vote up
private static DateFormat getInstance() {
    return SimpleDateFormat.getInstance();
}
 
Example 3
Source File: DateTimeRenderer.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
public DateTimeRenderer() {
    super();
    dateFormatter = (SimpleDateFormat) SimpleDateFormat.getInstance();
    //log.info("Simple inst");
}