惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
The Cloudflare Blog
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 司徒正美
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
C
Check Point Blog
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
V
V2EX
F
Fortinet All Blogs
B
Blog
大猫的无限游戏
大猫的无限游戏
N
Netflix TechBlog - Medium
B
Blog RSS Feed
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

博客园 - 五蕴非空

AI工具实践日记(二):在 OpenClaw 中调用 OpenCode 进行开发任务 AI工具实践日记(一):在树莓派上搭建OpenClaw,一个后端开发者的真实踩坑记录 .net core XML 解析帮助类 常用工具类 .net Core 同一接口不同实现的依赖注入 - 五蕴非空 大批量数据操作的性能优化方案 .net core 3.1 配置文件立即更新 为.net Core 3.0 WebApi 创建Linux守护进程 asp.net core 3.0 JObject The collection type 'Newtonsoft.Json.Linq.JObject' is not supported .net Core2.2 WebApi通过OAuth2.0实现微信登录 Asp.net导出Excel文件 Ext.Net 使用总结之GridPanel中的选中行 Ext.Net 使用总结之查询条件中的起始日期 Ext.Net 使用总结之GridPanel的删除事件 使用 NuGet 管理项目库 JavaScript 获取客户端计算机硬件及系统信息 程序员技术练级攻略 ThoughtWorks(中国)程序员读书雷达 Sql 分割 键值对字符串 得到某值对应的名称
Ext.net 中日期格式的计算
五蕴非空 · 2013-04-24 · via 博客园 - 五蕴非空

两个DateField控件,分别为开始时间和结束时间。当选择完结束时间后,自动计算这两个时间段所间隔的月或天数。

<ext:DateField runat="server" ID="extdate_start_date" LabelStyle=" text-align:right; " FieldLabel="开始时间" Vtype="daterange">
<CustomConfig>
    <ext:ConfigItem Name="endDateField" Value="#{extdate_end_date}" Mode="Value" />
</CustomConfig>
<Listeners>
      <Change Fn="GetBusiDay" />
</Listeners>
</ext:DateField>
<ext:DateField runat="server" ID="extdate_end_date" LabelStyle=" text-align:right; " FieldLabel="结束时间" Vtype="daterange">
     <CustomConfig>
          <ext:ConfigItem Name="startDateField" Value="#{extdate_start_date}" Mode="Value" />
     </CustomConfig>
      <Listeners>
          <Change Fn="GetBusiDay" />
      </Listeners>
</ext:DateField>

Js代码:

function GetBusiDay() {
            if (extdate_start_date.getValue() == "" || extdate_end_date.getValue() == "")
                return;
            var sday = Ext.util.Format.date(extdate_start_date.getValue(), 'Y/m/d');
            var eday = Ext.util.Format.date(extdate_end_date.getValue(), 'Y/m/d');
            var end = new Date(eday);
            var start = new Date(sday);

            var time = end.getTime() - start.getTime();
            var days = parseInt(time / (1000 * 60 * 60 * 24))+1;
            extnumb_busi_day.setValue(days);
        }

注意一定要转换日期格式 //日期格式为yyyy-mm-dd转换成yyyy/mm/dd