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

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…

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
55 Likes
TimeTools : The Tools Only For Time
How to show a notification once everyday
I am doing a simple alarm that sets off at a given date and time
How to use chatview with firebase?
How to set the next month
EPG viewer application
How to compare dates in format 12 Jun 2021
How can I Know that 1 month is over and member ship is over
How to get the Instant of the Online Time
Button once in day
Focus-redefine yourself V 3.0
Is this a proper way to use Format date time?
How to get time when One signal Push Notification Received
How Can I Get Duration Between dates
FTP Kodular - Application closes without any message
How to get time & date without device
Guys I have a problem with making the timer work when I'm outside the app !? The question is accompanied by the aia file
Calculating the duration of the user's absence on the discussion application, accompanied by blocks and aia file
Calculating the duration of the user's absence on the discussion application, accompanied by blocks and aia file
[Discontinued] Background Tasks [4.1] :partying_face:
Clock remains active when changing screen
Helping to view dates and time from newest to oldest
DateTools: Bad Arguments or Not Working
Your build failed due to an error in the Apkbuilder stage. Problem
How to check between 2 dates?
Calculating Difference of two dates in year month and day like datedif function in ms. excel
Issue in date tools extension by vknow360
Online Current Date
Issue with datetools extension
I want to store only online current date
NatureGO - Advanced Social Media App With Many Features
Daily free task
Date Formate Not Support
How to compare two dates and send me a notification
App compiling problem
How to return a range of days in the kodular
How to compare two dates by using clock component?
Use blocks to give your users trial only for three days or more free to use your app
How to get these date and time formats like kodular
How to know our utc time?
Can anyone help me make a Hour and Minute calculator?
Is there any countdown extension available?
Help me to translate the date format by json
If date is more than or equal to current date
How to reverse tag list of firebase
Get Duration between times
How to get automatic time setting on phone?
How to make online shopping app available to accept orders only in shop opening hours?
How to get current unix time without any delay

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

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

3 Likes

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

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

2 Likes

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

3 Likes

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

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

1 Like

:heart_eyes:
Even Blocks Would Have Taken more time
nice work

:thinking:hmm lets try someday

3 Likes

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

4 Likes

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

Pm for more…
We are hijacking this topic.

3 Likes

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

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

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

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?

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