DateTools : Get some tools for dates


Presenting my third extension to Community.
As you have read in title name of extension is DateTools and it is made specially to work with Dates.


(i) Functions/Methods
(ii) Properties/Getter and Setter


It has not so much blocks but some examples can help you to understand its usage.
Here are instructions to use it:


Returns day of given date.In above case it will return ‘Monday’
Note: You can also use DateTime besides Date


Returns difference between two dates in milliseconds.
To convert it in seconds divide by 1000
To minutes divide it by 1000*60
To hours divide it by 1000*60*60
To days divide it by 1000*60*60*24


Returns true if first date is after second date else false


Returns true if first date is before second date else false


Returns true if both dates are same else false

And for properties:


Get format of date previously set
By default it will return dd/MM/yyyy


Set format of date
Default format is dd/MM/yyyy

Note: Don’t forget to set format before using any function otherwise you can expect a runtime error

4.Aix/Extension file

Here are two download links:
Download Link 1: DateTools.aix (7.5 KB)

Download Link 2: DateTools.aix - Google Диск


Have a suggestion?
What are you waiting for?Just post that here.
Here you can post any suggestion,bug,question related to DateTools.


Nice work bro, really needs that extension, because i have made these things in my app with lot of blocks to compare dates and days etc , well done,


Glad you liked it:heart_eyes:
If you need any other feature then just post here…:sunglasses:

1 Like

Yes i liked it very much and i will check that when i go back to home and i think users also like same for time, like time compare Similar to this date tools there must be some thing like time tools ,

1 Like

I will try to make ‘TimeTools’…:slightly_smiling_face:

1 Like

Well Done Mate:blush:
But I Do Not Get Unique Ideas For Extension And Thats Why I Have Made One Basic extension :pensive:
But Well Done Many People Want This Feature in their app

1 Like

Actually I got inspiration to make DateTools from my most awaited project JobSwift , when I was working on a function related to date.

Got inspiration: 9:00am
Built extension: 10:00am

1 Like

There is lot of ideas, just post in community what users need and you will get a list of ideas,

Even Blocks Would Have Taken more time
nice work

:thinking:hmm lets try someday

1 Like

I have something for you.
Start using time tools extension.


ya i should try
but what will i do in it:cold_face:
which functions

Pm for more…
We are hijacking this topic.

1 Like

Good extension. Also all those methods can be done with simple blocks in procedures.
May be as one of the daily challenges we can see who can come up with the blocks equivalent of this extension.


Epoch in milliseconds to current timezone?

Better yet, here’s the code for it:

Calendar cal = Calendar.getInstance();
TimeZone tz = cal.getTimeZone();

/* debug: is it local time? */
Log.d("Time zone: ", tz.getDisplayName());

/* date formatter in local timezone */
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

/* print your timestamp and double check it's the date you expect */
long timestamp = cursor.getLong(columnIndex);
String localTime = sdf.format(new Date(timestamp * 1000)); // I assume your timestamp is in seconds and you're converting to milliseconds?
Log.d("Time: ", localTime);

Just import the things you need. Credit to How to convert UTC timestamp to device local time in android - Stack Overflow

1 Like