Java UUID Create uuidWithTime()

Here you can find the source of uuidWithTime()

Description

uuid With Time

License

Open Source License

Declaration

public static String uuidWithTime() 

Method Source Code

//package com.java2s;
/**/*w  w w  . j  a  v a2 s  .c o m*/
 * Copyright &copy; 2012-2013 <a href="http://www.hzmux.com">hzmux</a> All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class Main {

    public static String uuidWithTime() {
        String time = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
        return time + uuid();
    }

    public static String uuid() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
}

Related

  1. uuid()
  2. uuid()
  3. uuid()
  4. uuid()
  5. uuidFromString(String s)