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:
AddDaysToDate:
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
DateDifference
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
DateToUnixTimestamp
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
DaysInMonth
Get the number of days in a month. Example: DaysInMonth(5, 2022) returns 31
Parameter Type
month number
year number
Return Type: number
DaysToMonth
Convert days to Format , Month:Day⦠(Note): may b its not accurate because it takes days as Average 30
Parameter Type
days number
GetCurrentDate
Get the current date ofdevice
Return Type: text
GetCurrentDateTime
Get the current date and time
Return Type: text
GetCurrentTime
Get the current time of device
Return Type: text
GetOnlineTime
eg⦠Timezone OF Pakistan timezoneUTC +05:00
Parameter Type
timezoneUTC text
GetTimezoneOffset
Get the deviceβs timezone offset. Example: GetTimezoneOffset() returns +05:00
Return Type: text
IsDateAfter
Check if Date is After , Format = dd-MM-yyyy
Parameter Type
Date2 text
Date1 text
Return Type: boolean
IsDateBefore
Check if Date is Before , Format = dd-MM-yyyy
Parameter Type
Date2 text
Date1 text
Return Type: boolean
IsDateEqual
Check if Date is Equal , Format = dd-MM-yyyy
Parameter Type
Date2 text
Date1 text
Return Type: boolean
IsLeapYear
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
IsTimeAndTimeZoneAutomatic
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
MillisecondsToTimeFormat
Convert Milliseconds to time format. Example: MillisecondsToTimeFormat(7200000) returns β02 : 00 : 00β
Parameter Type
milliseconds number
MinutesToTimeFormat
Convert Minuts to Time Format , Example = Day:Hour:Minute
Parameter Type
minutes number
TimeDifference
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
UnixTimestampToDate
Convert a Unix timestamp to a date. Example: UnixTimestampToDate(1722538800) returns β02-08-2024β
Parameter Type
UnixTimestamp number
Return Type: text
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)