//var yourtime=document.getElementById('begin_time').value;
var yourtime='2010-12-10 11:12';
yourtime = yourtime.replace("-","/");//替换字符,变成标准格式
var d2=new Date();//取今天的日期
var d1 = new Date(Date.parse(yourtime));
alert(d1);
alert(d2);
if(d1>d2){
alert("开始大于结束");
}
//var yourtime=document.getElementById('begin_time').value;
var yourtime='2009-12-10'; yourtime = yourtime.replace(/-/g,"/");//替换字符,变成标准格式
var d2=new Date();//取今天的日期
var d1 = new Date(Date.parse(yourtime));
//alert(d1);
//alert(d2);
if(d1>d2){
alert("开始大于结束");
}

javascript比较两个时间大小的更多相关文章

  1. JavaScript获取两个时间的时间差

    <html><head><title>JavaScript计算两个时间差</title><meta http-equiv="conten ...

  2. WPF判断两个时间大小避免误差

    进行查询操作的时候,经常用到判断开始时间和结束时间大小的条件,由于从控件上获取的时间除了年月日时分秒,还包括毫秒.微秒等,导致直接判断时间大小的时候会产生一些误差,如下: 结果分析:年月日时分秒一致的 ...

  3. 【jQuery日期处理】两个时间大小的比较

    function checkEndTime(){ var startTime=$("#startTime").val(); var start=new Date(startTime ...

  4. javascript计算两个时间的差

    function GetDateDiff(startTime, endTime, diffType) { //将xxxx-xx-xx的时间格式,转换为 xxxx/xx/xx的格式 startTime ...

  5. java 比较两个时间大小

    Date d1 = new Date(System.currentTimeMillis()-1000); Date d2 = new Date(System.currentTimeMillis()); ...

  6. C#比较两个时间大小

    DateTime t1 = Convert.ToDateTime("2012-12-31 23:59:00");            DateTime t2 = Convert. ...

  7. 时间操作(JavaScript版)—最简单比較两个时间格式数据的大小

    呵呵呵,在软件研发过程中假设遇到要比較两个时间的大小.你会怎么做.嗯嗯嗯,非常直观的做法就是把"-"去掉,再比較大小,真的有必要吗?看以下最简单的时间比較方式: <!DOCT ...

  8. PHP中比较两个时间的大小与日期的差值

    在这里我们全用到时间戳 mktime(hour,minute,second,month,day,year,[is_dst])     其参数可以从右向左省略,任何省略的参数都会被设置成本地日期和时间的 ...

  9. 比较两个时间的大小 举例:CompareDate("12:00","11:15")

    //比较两个时间的大小 举例:CompareDate("12:00","11:15") function CompareDate(t1, t2) { var d ...

随机推荐

  1. LeetCode解题报告—— Best Time to Buy and Sell Stock

    Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a gi ...

  2. ultra-console

    console.__proto__.styleText = function (option) { if (!option) { console.groupCollapsed('请输入option') ...

  3. php极速后台开发框架LotusAdmin

    组件:基于thinkphp5.0.12+layui2.1版本 演示站点:https://www.lotusadmin.top/账号 : admin密码:123456 官方QQ交流群:606645328 ...

  4. qt调用仪器驱动库dll实现程控

    在<使用qt+visa实现程控>中实现了qt调用visa库的简单Demo本文将尝试使用qt调用仪器驱动库来实现对仪器仪表的程控 开发环境 系统: windows 10 环境: qt 5.8 ...

  5. lr11_Controller_Options选项介绍:

    lr11_Controller_Options选项介绍:

  6. Codeforces Round #490 (Div. 3) F - Cards and Joy

    F - Cards and Joy 思路:比较容易想到dp,直接dp感觉有点难,我们发现对于每一种数字要处理的情况都相同就是有 i 张牌 要给 j 个人分, 那么我们定义dp[ i ][ j ]表示 ...

  7. Disruptor Java版和.NET版的区别

    The main differences comes from the fact that .NET supports structs (value types), Java doesn't. In ...

  8. 图像 & 视频

    Python图像处理库:Pillow 初级教程 用Python做图像处理 python 视频处理,提取视频相关帧,读取Excel

  9. 关于 DP 的一些题目

    DP 是真的好玩. 口胡一段话题解: DP 题集 1 DP 题集 2

  10. iOS 9音频应用播放音频之控制播放速度

    iOS 9音频应用播放音频之控制播放速度 iOS 9音频控制播放速度 iOS9音频文件在播放时是以一定的速度进行的.这个速度是可以进行更改的,从而实现iOS9音频文件的快速播放和慢速播放功能.要实现i ...