Here you can find the source of getNowYMD()
public static String getNowYMD()
//package com.java2s; /**//w ww.jav a2s . c om * Tern Framework. * * @author fancimage * @Copyright 2010 qiao_xf@163.com Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 */ import java.util.Date; import java.text.SimpleDateFormat; public class Main { public static String getNowYMD() { String str = now(); return str.substring(0, 10); } public static String now() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dt = sdf.format(new Date()); return dt; } public static String now(String pattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); String dt = sdf.format(new Date()); return dt; } }