All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.phoenix.utils.GetNow Maven / Gradle / Ivy

Go to download

update:检查点bug修复,增加js执行的驱动,commandExecutor方法bug修复,驱动更新支持最新Firefox47/chrome51/IE10/IE11/IE Edge

There is a newer version: 1.5.0
Show newest version
package org.phoenix.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * 获取当前时间,并以各种形式返回。
* 并且可以对时间差进行计算
* @author mengfeiyang * */ public class GetNow { /** * 返回默认的当前的时间。返回格式为:yyyy-MM-dd HH:mm:ss
* @author mengfeiyang * @return */ public static String getCurrentTime(){ SimpleDateFormat sdf = new SimpleDateFormat("",Locale.SIMPLIFIED_CHINESE); sdf.applyPattern("yyyy-MM-dd HH:mm:ss"); //sdf.applyPattern("HH:mm:ss,SSS"); Date currDate = new Date(); String timeStr = sdf.format(currDate); return timeStr; } /** * 将当前获得的毫秒数转换成指定格式的时间.
* 如:"yyyy-MM-dd HH:mm:ss"
* @author mengfeiyang * @param PATTERN * @return */ public static String getCurrentTime(String PATTERN){ SimpleDateFormat sdf = new SimpleDateFormat("",Locale.SIMPLIFIED_CHINESE); sdf.applyPattern(PATTERN); Date currDate = new Date(); String timeStr = sdf.format(currDate); return timeStr; } public static String getFormatTime(Date date){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); return sdf.format(date); } /** * 将指定的毫秒数转换成指定格式的时间.
* 如:"yyyy-MM-dd HH:mm:ss"
* @author mengfeiyang * @param PATTERN * @return */ public static String getCurrentTime(long time,String PATTERN){ SimpleDateFormat sdf = new SimpleDateFormat("",Locale.SIMPLIFIED_CHINESE); sdf.applyPattern(PATTERN); String timeStr = sdf.format(time); return timeStr; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy