String expirTime = ”12 / 27 / 2018 12: 00: 00 AM”;
SimpleDateFormat in = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
SimpleDateFormat out = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
try {
idpData.setExpirationTime(out.format( in .parse(expirTime)));
System.out.println(idpData.getExpirationTime());
} catch (Exception e1) {
e1.printStackTrace();
}

SimpleDateFormat将月/日/年 时分秒转换为年-月-日 时:分:秒的更多相关文章

  1. H面试程序(1)编写一个函数,要求输入年月日时分秒,输出该年月日时分秒的 下一秒

    编写一个函数,要求输入年月日时分秒,输出该年月日时分秒的下一秒. 如输入 2004 年 12 月 31 日 23 时 59 分 59 秒,则输出 2005年 1 月 1 日 0 时 0 分 0 秒. ...

  2. js 时分秒与秒数的转换

    1. 时间戳 格式化为 时分秒(00:00:00) /** * 时间秒数格式化 * @param s 时间戳(单位:秒) * @returns {*} 格式化后的时分秒 */ var sec_to_t ...

  3. javascript将分,秒,毫秒转换为xx天xx小时xx秒(任何语言通用,最通俗易懂)

    // 传入参数为总分钟数,如果为秒数,毫秒数,需要对 // 此处得到总秒数 注释部分的代码调整下. function toDateDMS(minutes){ // 将分钟转换为 天,时,分,秒 if( ...

  4. oracle截取时间的年/月/日/时/分/秒

    修改日期格式为年月日时分秒: alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';select to_char(sysdate,'yyy ...

  5. Oracle 把秒转成时分秒格式(hh24:mm:ss);检测字符串是否是数字;字符串转换为数字

    不说废话,贴代码: CREATE OR REPLACE FUNCTION to_time(sec IN NUMBER) RETURN VARCHAR2 IS /*把秒转成时分秒格式 auth lzpo ...

  6. php如何计算两个时间戳之间相差的日时分秒

    /功能:计算两个时间戳之间相差的日时分秒//$begin_time 开始时间戳//$end_time 结束时间戳function timediff($begin_time,$end_time){ if ...

  7. [置顶] java得到前一个月的年月日时分秒

    import java.util.Calendar; /** * 得到前一个月的年月日时分秒 * @author Mr.hu * 2013-6-28上午12:00:35 * Class Explain ...

  8. [Java]两个将秒数转化为日时分秒形式的函数

    比如900秒要反应一下,说15分就直观了.下面两个函数性能差不多,大家任意取用. 代码: import java.util.concurrent.TimeUnit; public class Test ...

  9. C#比较时分秒大小,终止分钟默认加十分钟,解决跨天、跨月、跨年的情况

    private void cmbInHostimes_SelectedIndexChanged(object sender, EventArgs e) { DataRow[] dr; if (chkM ...

随机推荐

  1. python 数据分析--pandas

    接下来pandas介绍中将学习到如下8块内容:1.数据结构简介:DataFrame和Series2.数据索引index3.利用pandas查询数据4.利用pandas的DataFrames进行统计分析 ...

  2. 记一次用express手写博客

    1.req.session时一直是undefined 解决方法: // sesssion应用的配置 app.use(session({ secret:'blog', cookie: ('name', ...

  3. tensorflow 只恢复部分模型参数

    import tensorflow as tf def model_1(): with tf.variable_scope("var_a"): a = tf.Variable(in ...

  4. 执行git命令时出现fatal: 'origin' does not appear to be a git repository错误

    在执行git pull origin master时出现: fatal: 'origin' does not appear to be a git repository fatal: Could no ...

  5. [Leetcode 40]组合数和II Combination Sum II

    [题目] Given a collection of candidate numbers (candidates) and a target number (target), find all uni ...

  6. 并查集(POJ1182)

    链接:http://poj.org/problem?id=1182 定义一种关系R(x,y),x > y 时 R(x,y) = 2:x = y 时 R(x,y)= 1:x < y 时 R( ...

  7. datatable处理gridview筛选后的值

    DataTable dt = (DataTable)gridView1.GridControl.DataSource; DataRow[] drr = dt.Select(gridView1.RowF ...

  8. 在win中,给powershell客户端,搭建sshd服务器。

    下载:https://github.com/PowerShell/Win32-OpenSSH/releases     问:为什么要用这个sshd?答:这是微软用,openssh官方的源码,源码网址: ...

  9. RAID阵列盘有一块状态变为外来处理方法

    感谢: https://blog.csdn.net/cmzsteven/article/details/63680933

  10. Mysql和Hadoop+Hive有什么关系?

    1.Hive不存储数据,Hive需要分析计算的数据,以及计算结果后的数据实际存储在分布式系统上,如HDFS上. 2.Hive某种程度来说也不进行数据计算,只是个解释器,只是将用户需要对数据处理的逻辑, ...