Java tutorial
//package com.java2s; /** * Copyright (c) 2012 Todoroo Inc * * See the file "LICENSE" for the full license governing this code. */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** * Get current date and time as a string. Used for naming backup files. */ public static String getDateForExport() { DateFormat df = new SimpleDateFormat("yyMMdd-HHmm"); return df.format(new Date()); } }