Adobe Air 中两个日期之间的日期差异
如何使用 Flex builder 4.5 通过 Adobe Air Desktop 应用程序中的 DateChooser 组件比较用户选择的两个日期之间的天数(int)差异?
import mx.controls.DateChooser;
import mx.controls.Text;
private var date1:String;
date1 = date_from.text; //giving error 1120:Access of undefined property date_form
How to compare the days(int) difference between two dates chosen by user, via DateChooser component in Adobe Air Desktop application using Flex builder 4.5 ?
import mx.controls.DateChooser;
import mx.controls.Text;
private var date1:String;
date1 = date_from.text; //giving error 1120:Access of undefined property date_form
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Flex 中的日期数学支持很差,而且看起来非常不准确。 Flex 可能是一种即将退出的语言,但为了子孙后代和任何可能存在的遗留代码,请不要使用 user1196374 接受的答案。他们的回答很粗略而且非常不准确。
下面我包含了我为执行既定目标而开发的代码,该目标最初使用他在这篇文章中的代码作为起点。
免责声明,我不知道这是否涵盖了之前功能中的所有缺陷,也不知道它是否能很好地处理其他日历。然而,它是一个比公认的答案更好的解决方案。
Date math in flex is poorly supported, and very inaccurate it seems. Flex might be a language on the way out but for posterity sake and any legacy code which might hang around, please do not use the accepted answer by user1196374. Their answer is rough and very inaccurate.
Below I have included code I developed to perform the stated goal, which had initially used his code in this post as a starting point.
Disclaimer, I don't know if this covers every flaw in the previous function, nor do I know if it will handle other calendars well. It is however a vastly better solution than the accepted answer.