Java tutorial
//package com.java2s; import java.sql.Date; import java.text.SimpleDateFormat; import java.util.Locale; import java.util.Random; public class Main { public static String getFileName(String suffix) { Date date = new Date(System.currentTimeMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat("'xc'_yyyyMMddHHmmss", Locale.CHINESE); String randomNumber = "_" + new Random().nextInt(10000); return dateFormat.format(date) + randomNumber + suffix; } }