Convert Java Date to Mysql Date

Normal 0 21 false false false MicrosoftInternetExplorer4

public static String toMysqlDateStr(Date date){

if (date==null)

return "NULL";

SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

return '\''+sdf.format(date)+'\'';

}

Comments

Popular posts from this blog

Connect via SSH without a password from MacOS to Linux with an SSHKEY

Read and Write Files in Java

Install Mac OS on windows laptop