Write a short description
DateAndTimeTool
A comprehensive utility class providing various methods to manipulate date and time settings on android devices and also calculate dates and times. This tool offers functionalities to:
- Support online time by Timzoneoffset
 - Compare dates (before, after, equal)
 - Add days to a date
 - Convert milliseconds to time format
 - Convert days to month format
 - Check leap years
 - Get days in a month
 - Convert Unix timestamps to dates and vice versa
 - Get current date, time, and timezone offset
 - Calculate date and time differences
 - Format date strings
 - Check automatic time and time zone settings
 
Add a picture of all the blocks
Methods:
1-AddDaysToDate:
Usage
Add days to a given date. Format: dd-MM-yyyy. Example: AddDaysToDate('12-05-2022', 5) returns '17-05-2022'
Parameter	Type
Date	text
addDays	number
Return Type: text
2-DateDifference
Usage
Calculate date difference between two dates. Format: dd-MM-yyyy. Example: DateDifference('12-05-2022', '10-05-2022') returns '2 days' and '0 Months : 2 Days'
Parameter	Type
date2	text
date1	text
3-DateToUnixTimestamp
Usage
Convert a date to a Unix timestamp. Format: dd-MM-yyyy. Example: DateToUnixTimestamp('02-08-2024') returns 1722538800
Parameter	Type
Date	text
Return Type: text
4-DaysInMonth
Usage
Get the number of days in a month. Example: DaysInMonth(5, 2022) returns 31
Parameter	Type
month	number
year	number
Return Type: number
5-DaysToMonth
Usage
Convert days to Format , Month:Day.. (Note): may b its not accurate because it takes days as Average 30
Parameter	Type
days	number
6-GetCurrentDate
Get the current date of device
Return Type: text
7-GetCurrentDateTime
Get the current date and time
Return Type: text
8-GetCurrentTime
Get the current time of device
Return Type: text
9-GetOnlineTime
Usage
eg.. Timezone OF Pakistan timezoneUTC +05:00
Parameter	Type
timezoneUTC	text
10-GetTimezoneOffset
Usage
Get the device's timezone offset. Example: GetTimezoneOffset() returns +05:00
Return Type: text
11-IsDateAfter
Usage
Check if Date is After ,
Format = dd-MM-yyyy
Parameter	Type
Date2	text
Date1	text
Return Type: boolean
12-IsDateBefore
Usage
Check if Date is Before ,
Format = dd-MM-yyyy
Parameter	Type
Date2	text
Date1	text
Return Type: boolean
13-IsDateEqual
Usage
Check if Date is Equal ,
Format = dd-MM-yyyy
Parameter	Type
Date2	text
Date1	text
Return Type: boolean
14-IsLeapYear
usage
A leap year is a year that has 366 days, instead of the usual 365 day bcz feb has 29 days in leap year
Parameter	Type
year	number
Return Type: boolean
15-MillisecondsToTimeFormat
Usage
Convert Milliseconds to time format. Example: MillisecondsToTimeFormat(7200000) returns '02 : 00 : 00'
Parameter	Type
milliseconds	number
16-UnixTimestampToDate
Usage
Convert a Unix timestamp to a date. Example: UnixTimestampToDate(1722538800) returns '02-08-2024'
Parameter	Type
UnixTimestamp	number
Return Type: text
17-MinutesToTimeFormat
Usage
Convert Minuts to Time Format ,
Example = Day:Hour:Minute
Parameter	Type
minutes	number
18-TimeDifference
Usage
Calculate time difference between two times. Example: TimeDifference('02:30:00 PM', '01:30:00 PM') returns '01 : 00 : 00'
Parameter	Type
time2	text
time1	text
Return Type: text
19-IsTimeAndTimeZoneAutomatic
Usage
check if AutoTime is enable or both AutoTime and AutoTimzone both are enable, in-short its working for all devices to andriod 14 or later
Return Type: boolean
Events:
GotDateDifference
Event triggered when date difference is calculated
Parameter	Type
format1	text
format2	text
GotDaysToMonth
Event triggered when milliseconds are converted to time format
Parameter	Type
format1	text
format2	text
GotMillisecondsToTimeFormat
Event triggered when milliseconds are converted to time format
Parameter	Type
format1	text
format2	text
format3	text
GotMinutesToTimeFormat
Event triggered when minutes are converted to time format
Parameter	Type
format1	text
format2	text
format3	text
GotOnlineTime
[format1 = 1/1/2000-4:00:00 pm] [format2 = Fri/1/2000-4:00:00 pm] [format3 = Friday/1/2000-4:00:00 pm] [format4 = 1/Jan/2000-4:00:00 pm] [format5 = 1/January/2000-4:00:00 pm] [format24hours = 1/January/2000-16:00:00]
Parameter	Type
format1	text
format2	text
format3	text
format4	text
format5	text
format24hours	text
Downloading link : version 1
DateAndTimeTools.aix (14.5 KB)



























