Here you can find the source of getFormattedTimestamp()
private static String getFormattedTimestamp()
//package com.java2s; /*//from w ww . j a v a 2s . c o m * Copyright (c) 2009 Netcetera AG and others. * All rights reserved. * This program and the accompanying materials are made available under * the terms of the Eclipse Public License v1.0 which accompanies this * distribution, and is available at * * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * - Netcetera AG: initial implementation */ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { private static final String DATEFORMAT_PATTERN = "yyyy-MM-dd HH:mm:ss"; /** * Gets a properly formatted timestamp. * * @return a formatted timestamp */ private static String getFormattedTimestamp() { return new SimpleDateFormat(DATEFORMAT_PATTERN, Locale.US).format(new Date()); } }