DS 一周中的第几天 短型 从周一算起
hh 小时
mm 分钟
ss 秒
mss 毫秒
DDD 一年中的第几天
WW 一年中的第几周
WWW 一年中的第几周并用W标识
W 一个月中的第几周
E 年代,公元前还是公元后
TZL 时间长型
TZS 时间短型
*
*/
log.warn(jdt.convertToDate()) ;
log.warn(jdt.toString("YYYY-MM-DD"));
log.warn(jdt.toString("YYYY-MM-DD hh:mm:ss"));//转换成字符串
log.warn(jdt.toString("WW"));//本年度第几周
log.warn(jdt.toString("YYYY")) ;
}
}
JODD操作properties文件
[java]
package org.xiaochen.test.jodd;
import java.io.File;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.junit.Test;
import jodd.props.Props;
/**
* JODD操作properties文件
* @author DJZHOU
*
*/
public class PropUtil {
private static Logger log = Logger.getLogger(PropUtil.class) ;
@Test
public void propExam(){
/*
* 读取prop文件中的属性值
*/
Props p = new Props();
log.warn(URLUtil.getClassPath(this.getClass())+"/a.properties") ;
try {
p.load(new File(URLUtil.getClassPath(this.getClass())+"/a.properties"));
} catch (IOException e) {
e.printStackTrace();
}
String story = p.getValue("a");
log.warn(p.getBaseva lue("a")) ;
log.warn(story);
log.warn(null == p.getValue("a")) ;
log.warn(p.toString()) ;
p.setValue("c", "cc") ;
}
}
JODD操作email类
package org.xiaochen.test.jodd;
import java.io.File;
import java.io.IOException;
import org.junit.Test;
import jodd.io.FileUtil;
import jodd.mail.Email;
import jodd.mail.EmailAttachment;
import jodd.mail.EmailMessage;
import jodd.mail.SendMailSession;
import jodd.mail.SmtpSslServer;
import jodd.mail.att.ByteArrayAttachment;
import jodd.mail.att.FileAttachment;
import jodd.util.MimeTypes;
/**
* JODD操作email类
*
* @author DJZHOU
*
*/
public class EmailUtil
{
public static void main(String[] args)
{
Email email = Email.create();
email.addMessage(new EmailMessage("消息"));
email.addText("邮件内容");
email.embedFile(new File("d:/console.txt"));
email.from("771842634@qq.com").to("771842634@qq.com");
email.subject("主题");
SendMailSession mailSession = new SmtpSslServer("smtp.qq.com//发送端邮箱服务器协议", "发送端QQ邮箱", "发送端QQ邮箱密码").createSession();
mailSession.open();
mailSession.sendMail(email);
mailSession.close();
System.out.println("发送成功!...");
}
@Test
public void test() throws IOException
{
Email email = new Email();
email.setFrom("infoxxx@jodd.org");
email.setTo("igorxxxx@gmail.com");
email.setSubject("test7");
EmailMessage textMessage = new EmailMessage("Hello!", MimeTypes.MIME_TEXT_PLAIN);
email.addMessage(textMessage);
EmailMessage htmlMessage = new EmailMessage(
"" +
"
Hey!

Hay!
",MimeTypes.MIME_TEXT_HTML);
email.addMessage(htmlMessage);
EmailAttachment embedded