DateTools : Some tools to work with date and time

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: 2020-07-20T04:07:00Z

2.Blocks

image

image

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.

image

Returns day of given date.
Note: You can also use DateTime besides Date

image

Returns difference between two dates or datetime in milliseconds.

image

Returns true if first date is after second date else false

image

Returns true if first date is before second date else false

image

Returns true if both dates are same else false

image

Returns a list of available timezones

Converts epoch timestamp to date in the given date format in provided timezone

image

Returns device’s current date and time

image

Returns current date and time in raw format

image

Returns current epoch timestamp

image

Display name of current timezone

image

Returns ID of current timezone

Converts millis in y d m s format

image

Converts epoch timestamp to date and time

image

Difference between two epoch timestamps in y d m s format

image

Returns offset of current timezone

image

Converts rawoffset(int) to offset

Gets offset from timezone id

image

Returns true if local datetime is in day light savings

Returns a list of available timezones in given offset

image

Returns DST savings of current timezone in milliseconds

component_method

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: DateTools.aix - Google Drive

5.Liked my work/Support me

Really??
Thank you for your love.
As I have said already that my extensions will be free so I will never ask someone to pay me.
But if you want to support me then please download extension from this shortened link:

Download Link3: http://raboninco.com/21784285/datetools-aix

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…

component_method%20(9)

component_method%20(10)

scrnli_10_28_2019_8-45-49%20AM

scrnli_10_28_2019_8-46-55%20AM

scrnli_10_28_2019_8-47-45%20AM

scrnli_10_28_2019_8-48-33%20AM

scrnli_10_28_2019_8-49-54%20AM

scrnli_10_28_2019_8-51-04%20AM

scrnli_10_28_2019_8-53-47%20AM

Bug Fixes/Changes

  • Some minor changes
ChangeLog Version3

New Blocks
image

image

image

image

image

image

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:
image

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

  • Some internal changes
ChangeLog Version 6.1

Bug Fixes

  • Removed un-necessary NTP servers from list
25 Likes

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,

2 Likes

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

2 Likes

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

:heart_eyes:
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.

2 Likes

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.

5 Likes

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

1 Like

ChalgeLog Version 2

New Blocks

Some new blocks have been added in Version 2 to make it easier to work with dates…

component_method%20(9)

Returns a list of available timezones

Converts epoch timestamp to date in the given date format in provided timezone

component_method%20(10)

Returns device’s current date and time

scrnli_10_28_2019_8-45-49%20AM

Returns current date and time in raw format

scrnli_10_28_2019_8-46-55%20AM

Returns current epoch timestamp

scrnli_10_28_2019_8-47-45%20AM

Display name of current timezone

scrnli_10_28_2019_8-48-33%20AM

Returns ID of current timezone

scrnli_10_28_2019_8-49-54%20AM

Converts millis in y d m s format

scrnli_10_28_2019_8-51-04%20AM

Converts epoch timestamp to date and time

scrnli_10_28_2019_8-53-47%20AM

Difference between two epoch timestamps in y d m s format

Bug Fixes/Changes

  • Some minor changes
1 Like

Can You Update This Extension By Adding Event Blocks Like Time Tools Extension Made By @krishjha07? It Will Be Very Useful. Thanks.

Hi
Thank you for your precious suggestion.
But I am still not able to understand it.
Can you explain more?

1 Like


Can you create a block like this? So that we can store value in database?

That block is of TimeTools extension but why you want that block in DateTools extension :thinking:
Both are quite different