vknow360
(Sunny Gupta)
October 7, 2019, 1:30pm
1
1.Introduction
DateTools
As the name suggests it is specially made to work with Dates but since it uses SimpleDateFormat so you can also work with Time by using appropriate format.
Latest Version: 6.1
Last Updated: Invalid date
2.Blocks
It has 22 function blocks and 1 event block
3.Documentation
It has not so much coplex blocks but some examples can help you to understand its usage.
Returns day of given date.
Note: You can also use DateTime besides Date
Returns difference between two dates or datetime in milliseconds.
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
Returns a list of available timezones
Converts epoch timestamp to date in the given date format in provided timezone
Returns device’s current date and time
Returns current date and time in raw format
Returns current epoch timestamp
Display name of current timezone
Returns ID of current timezone
Converts millis in y d m s format
Converts epoch timestamp to date and time
Difference between two epoch timestamps in y d m s format
Returns offset of current timezone
Converts rawoffset(int) to offset
Gets offset from timezone id
Returns true if local datetime is in day light savings
Returns a list of available timezones in given offset
Returns DST savings of current timezone in milliseconds
Requests to NTP server to get online date time in milliseconds and raises event ‘GotOnlineDateTime’ with epoch timestamp and response.If any error occurs then timestamp will be ‘0’
Thanks to @Alapjeet
4.Aix/Extension file
Here are two download links:
Download Link 1: com.sunny.DateTools.aix (43.0 KB)
Download Link 2: https://drive.google.com/file/d/1tkNMWOltSD8YYPwjBaCpglaFeKCUEuxg/view?usp=sharing
5. Liked my work/Support me
Thank you for your love.
6.Updates/Bug Fixes
ChangeLog Version2
New Blocks
Some new blocks have been added in Version 2 to make it easier to work with dates…
Bug Fixes/Changes
ChangeLog Version3
New Blocks
Bug fixes/Changes
1.Fixed bug in ‘Difference’ block.Reported by @thiagofernandes055
2.Some minor changes in existing blocks
ChangeLog Version4
New blocks
Just one new block with its event handler:
Bug Fixes/Changes
Some spelling fixes
Replaced some old libraries with new libraries
Some other minor changes
ChangeLog Version5
Changes
Removed DateFormat
property
Bug Fixes
Fixed bug in GetOnlineDateTime
block
Thanks to @kitavalf
ChangeLog Version6
Bug Fixes
Changes
ChangeLog Version 6.1
Bug Fixes
Removed un-necessary NTP servers from list
55 Likes
ImranTariq
(Imran Tariq)
October 7, 2019, 2:09pm
2
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,
3 Likes
vknow360
(Sunny Gupta)
October 7, 2019, 2:16pm
3
Glad you liked it
If you need any other feature then just post here…
3 Likes
ImranTariq
(Imran Tariq)
October 7, 2019, 2:18pm
4
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 ,
3 Likes
vknow360
(Sunny Gupta)
October 7, 2019, 2:21pm
5
I will try to make ‘TimeTools’…
2 Likes
krish.jha
(krishjha07)
October 7, 2019, 2:22pm
6
Well Done Mate
But I Do Not Get Unique Ideas For Extension And Thats Why I Have Made One Basic extension
But Well Done Many People Want This Feature in their app
3 Likes
vknow360
(Sunny Gupta)
October 7, 2019, 2:26pm
7
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
6 Likes
ImranTariq
(Imran Tariq)
October 7, 2019, 2:27pm
8
There is lot of ideas, just post in community what users need and you will get a list of ideas,
1 Like
krish.jha
(krishjha07)
October 7, 2019, 2:28pm
9
vknow360:
ted
Even Blocks Would Have Taken more time
nice work
vknow360
(Sunny Gupta)
October 7, 2019, 2:29pm
11
I have something for you.
Start using time tools extension.
4 Likes
krish.jha
(krishjha07)
October 7, 2019, 2:30pm
12
ya i should try
but what will i do in it
which functions
vknow360
(Sunny Gupta)
October 7, 2019, 2:31pm
13
Pm for more…
We are hijacking this topic.
3 Likes
Italo
(Italo)
October 7, 2019, 3:25pm
14
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.
7 Likes
hammerhai
(Nathan)
October 8, 2019, 1:23am
15
vknow360:
Have a suggestion?
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");
sdf.setTimeZone(tz);
/* 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
2 Likes
vknow360
(Sunny Gupta)
October 28, 2019, 3:26am
16
ChalgeLog Version 2
New Blocks
Some new blocks have been added in Version 2 to make it easier to work with dates…
Returns a list of available timezones
Converts epoch timestamp to date in the given date format in provided timezone
Returns device’s current date and time
Returns current date and time in raw format
Returns current epoch timestamp
Display name of current timezone
Returns ID of current timezone
Converts millis in y d m s format
Converts epoch timestamp to date and time
Difference between two epoch timestamps in y d m s format
Bug Fixes/Changes
4 Likes
Can You Update This Extension By Adding Event Blocks Like Time Tools Extension Made By @krish.jha ? It Will Be Very Useful. Thanks.
vknow360
(Sunny Gupta)
November 15, 2019, 3:08pm
18
Hi
Thank you for your precious suggestion.
But I am still not able to understand it.
Can you explain more?
2 Likes
Can you create a block like this? So that we can store value in database?
vknow360
(Sunny Gupta)
November 16, 2019, 12:45am
20
That block is of TimeTools extension but why you want that block in DateTools extension
Both are quite different