public class Util { public function Util() { } /** * 时间处理类,相加返回相加后的date * @param datepart 要相加的时间位置 * @param number 相加的数值 * @param date 相加的date没有传入是当前时间 * @return 返回的是相加后的date * yxy */ public function dateAdd(datepart:String = "", number:Number = 0, date:Date = null):Date { if (date == null) { /* Default to current date. */ date = new Date(); } var returnDate:Date = new Date(date.time);; switch (datepart.toLowerCase()) { case "fullyear": case "month": case "date": case "hours": case "minutes": case "seconds": case "milliseconds": returnDate[datepart] += number; break; default: /* Unknown date part, do nothing. */ break; } return returnDate; } /** * 两个date的的时间差 * @param dataBegin 开始时间 * @param dateEnd 结束时间 * @return 返回差的天数 * */ public function dateDiff(dataBegin:Date,dateEnd:Date):Number{ var diff:Number = (dateEnd.time-dataBegin.time)/new Number(24*60*60*1000); return diff; } /** * 比较两date的大小 * @param date1 * @param date2 * @return date1<date2返回-1,date1=date2返回0,date1>date2返回1。 * */ public function dateCompare(date1:Date, date2:Date):int { if (Number(date1) < Number(date2)) { return -1 } if (Number(date1) == Number(date2)) { return 0; } return 1; } }
For more articles related to flex actionScript time processing addition and returning the added date, please pay attention to the PHP Chinese website!
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article
How to fix KB5055612 fails to install in Windows 10?
4 weeks agoByDDD
Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Roblox: Grow A Garden - Complete Mutation Guide
3 weeks agoByDDD
Nordhold: Fusion System, Explained
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools
