Here you can find the source of nowDateString()
public static String nowDateString()
//package com.java2s; /*//from www .j ava 2 s. c o m * DateTimeUtils.java * * Copyright (c) 1998 - 2006 BusinessTechnology, Ltd. * All rights reserved * * This program is the proprietary and confidential information * of BusinessTechnology, Ltd. and may be used and disclosed only * as authorized in a license agreement authorizing and * controlling such use and disclosure * * Millennium ERP system. * */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** * Return a string formatted as yyyyMMddHHmmss * * @return String formatted for right now */ public static String nowDateString() { SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); return df.format(new Date()); } }