首页 \ 问答 \ 计算时间和日期差异(Calculating Time and Date difference)

计算时间和日期差异(Calculating Time and Date difference)

我目前正在编写一份报告来计算iReport中两个日期变量之间的TotalTimeDifference

我正在比较的两个变量是MO_DATECREATEDMO_DATECOMPLETED并且我试图只计算时间差。

我曾尝试设置一个变量,对两个变量进行简单的减法 - 当然,这根本没有奏效。

我会附上我目前拥有的照片,但我正在寻找比较两个变量(包含日期/时间)和打印出时间差异变量的方式。

例如:如果MO started at 1/2/15 12:55pmcompleted at 1/3/15 1:55pm我想打印时间差或花费多少时间为25 hours

我如何在iReport中做到这一点? 感谢您帮助新手!

我的问题我的报告

编辑答案后,我想展示的日子:


I am currently writing a report to calculate the TotalTimeDifference between two date variables in iReport.

The two variables that I am comparing are MO_DATECREATED and MO_DATECOMPLETED and I am trying to calculate the time difference only.

I have tried setting up a variable that does a simple subtraction of the two variables- and of course that has not worked at all.

I will attach photoes of what I currently have but I am looking for the way to compare the two variables (which contains date/time) and printing out a variables with the difference in time.

Example: If the MO was started at 1/2/15 12:55pm and completed at 1/3/15 1:55pm i want to print the time difference, or how long it took, as 25 hours

How can I do this in iReport? Thank you for helping out a newbie!

My problem MyReport

EDIT After answer, I would like to the show days to:


原文:https://stackoverflow.com/questions/34661493
更新时间:2024-04-25 17:04

最满意答案

你可以这样做:

$(".user").click(function () {
    // Hide it but only if not hidden - hide
    $('.trigger:visible').hide();

    // Later in the script - Show it but only If it's not visible.  
    $('.trigger:hidden').show();
});

对于更多的上下文,在下列情况下元素被视为“隐藏”:

  • 它们的CSS显示值为none。
  • 它们是type =“hidden”的表单元素。
  • 它们的宽度和高度显式设置为0。
  • 或者祖先元素被隐藏,所以元素不会显示在页面上。

此外,“具有可见性的元素:隐藏或不透明度:0被认为是可见的。”

来源: https//api.jquery.com/hidden-selector


You can do this:

$(".user").click(function () {
    // Hide it but only if not hidden - hide
    $('.trigger:visible').hide();

    // Later in the script - Show it but only If it's not visible.  
    $('.trigger:hidden').show();
});

For some more context, elements are deemed ":hidden" if:

  • They have a CSS display value of none.
  • They are form elements with type="hidden".
  • Their width and height are explicitly set to 0.
  • Or an ancestor element is hidden, so the element is not shown on the page.

Additionally, "elements with visibility: hidden or opacity: 0 are considered to be visible."

Source: https://api.jquery.com/hidden-selector

相关问答

更多
  • 您可以只使用一个叠加
    并在点击时更改background , z-index和content ,例如使用toggleClass 。 我稍微更改了你的代码,所以你有一个工作示例http://codepen.io/anon/pen/vKKJEq You could do just one overlay
    and change background, z-index and content of it on click, with toggleClass for example. I chan ...
  • 代替 .. $(".accordion-content:hidden") 做: $(".accordion-content").is(':hidden') 因为你使用“else”,所以真的不需要最后的“可见”选项。 但如果你想使用它,那么: $(".accordion-content").is(':visible') Instead of .. $(".accordion-content:hidden") Do: $(".accordion-content").is(':hidden') Ther ...
  • 你可以这样做: $(".user").click(function () { // Hide it but only if not hidden - hide $('.trigger:visible').hide(); // Later in the script - Show it but only If it's not visible. $('.trigger:hidden').show(); }); 对于更多的上下文,在下列情况下元素被视为“隐藏”: 它们的C ...
  • 使用: .is(':visible')将显示可见的 $(".poi-hover").on( { mouseenter: function() { //$(".poi-hover").css('opacity', 0.2); $('.poi-hover:visible').not(this).css('opacity', 0.2); $(".button_pannel").css('opacity' ...
  • 您不需要绑定两次单击,而是可以将条件显示和隐藏。 $('.plus').click(function(){ if($('#top').is(':visible') $('#top').hide('slow'); else $('#top').show('slow'); }); 您还可以使用toogle活动 $('.plus').toggle(function(){ $('#top').show('slow'); }, fun ...
  • 相关文章

    更多
  • The Log: What every software engineer should know about real-time data's unifying abstraction
  • Real-Time Rendering 笔记 --- 1-4章
  • Java日期时间
  • 在java.util.Date中,如何比较两个Date的大小,精确到分
  • 用SimpleDateFormat把字符串转换成Date的时候报NumberFormatException
  • display控件格式化时间日期的问题?
  • 日期和时间的国际化
  • JFreeChart笔记 (十) 时间序列图:差异对比图
  • Javascript取当前日期、时间、星期的代码
  • java计算某天与今天相差的天数
  • 最新问答

    更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)