LocalDateTime和StringUtils使用

package lambda;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

public class TestTime {

	public static void main(String[] args) {
		
	  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
	  LocalDateTime oldEndTime=LocalDateTime.parse("2021-09-04 19:00:00",formatter);
	  System.out.println("oldEndTime===="+oldEndTime); 
	  LocalDateTime now=LocalDateTime.now(); System.out.println(now);
	  
	  System.out.println("===="+now.isAfter(oldEndTime));
		 
		List<String>list=new ArrayList<>();
		String mm=String.format("%s=%s", "zhangsan",123);
		String nn=String.format("%s=%s", "lisi",123);
		list.add(mm);
		list.add(nn);
		
		String publicReqStr = StringUtils.join(list, "&");
		System.out.println("mmm==="+mm);
		System.out.println("publicReqStr==="+publicReqStr);
	}
}

  

 

posted @ 2021-08-11 09:51  红尘沙漏  阅读(28)  评论(0编辑  收藏  举报