Skip to content

Instantly share code, notes, and snippets.

@isaacpompa
Last active February 15, 2017 00:00
Show Gist options
  • Save isaacpompa/b26360e34ea3d43e5e64bfca11639ba2 to your computer and use it in GitHub Desktop.
Save isaacpompa/b26360e34ea3d43e5e64bfca11639ba2 to your computer and use it in GitHub Desktop.

Revisions

  1. isaacpompa revised this gist Feb 15, 2017. No changes.
  2. isaacpompa created this gist Feb 14, 2017.
    22 changes: 22 additions & 0 deletions CurrentTime.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    private String getCurrentTime(){

    final SimpleDateFormat dateFormat;
    String currentTime = null;
    Date date;
    Long date_miliseconds = null;

    try {


    dateFormat = new SimpleDateFormat("HH:mm:ss.SSS_yyyy-MM-dd");
    date = new Date();
    date_miliseconds = date.getTime();

    currentTime = dateFormat.format(date);

    } catch (Exception ex) {
    System.out.println("getCurrentTime [EXCEPTION]: " + ex);
    currentTime = null;
    }
    return currentTime;
    }