How to Pick a period of time instead of specific time ReactNative - android

I'm using react-native Timepicker to pick a starting_time. but instead of ending_time i want to pick operation duration time, but it can not be done using timepicker. how can i pick a period of time instead of specific time?
now my app do this:
starting_time: 8 am
ending_time: 10 am
but what i want is:
starting_time: 8am
duration: 2 hours

I had the similar problem i fixed it using Time picker and Picker here is the screen shot.
if this solves your problem i can share the reusable components.

Related

TimeZone extra hour with getDSTSavings()

I'm trying to show time saved at GMT+0 on serverside. Was using the code below to show relative time, however, now it gives an extra hour. How can I show relative time span that will work all around the world and timesaving sensitive?
When I don't add TimeZone.getDefault().getDSTSavings() it works as expected. However, before, it was working as expected when I add it.
Couldn't find a changelog for Calendar.getInstance() about it started to include daytime savings or not.
android.text.format.DateUtils.getRelativeTimeSpanString(1473846745000L,
Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis() +
TimeZone.getDefault().getDSTSavings(),
android.text.format.DateUtils.SECOND_IN_MILLIS)

Setting Reminder/trigger alarm on user defined date and time

I have trouble implementing Reminder for my app.i did research but couldnt find proper solution.
what i want is:
i am developing an android app which has one feature to remind users about the selected event 30 min before event start.
i will be displaying the date and time of the event in textview,on click of reminder button reminder will set 30min before event.
how can i proceed to implement this.
Note: i dont want to use date/time picker, specific date and time will be taken directly from text view which i will display.
Any suggestion/links with logic please help.
if any one can help dn please tell me the logic to add future,date + hours + minutes to current time to set alarm(date and time will be taken from textview)

MomentJS like functionality for Android Apps

I have a record with date and time, and I would want to convert the transaction date from current date, differentiate and show number of days.
For e.g.
If the the record has got a date time, which is 1 hours before than Now, the system should show an hour ago...
Similarly if there is a record with 3 days before then instead of showing a date, I would want to show "3 days ago".
No need to use any custom solution.
You can use android.text.format.DateUtils.getRelativeTimeSpanString
It returns a string describing 'time' as a time relative to 'now'.
reference: http://developer.android.com/reference/android/text/format/DateUtils.html

Android TimePicker custom minute step

The default Android Time Picker, have a step of 1 for minute. I want to change it to a step of 5 minutes. so by clicking on the "+" button, the time 09:20 become 09:25.
Is there an easy way to do it ?
You have to write your own TimePicker. I'm not sure if you can extend the existing TimePicker and handle the button events on your own. Here is more detailed answer for your question:
Android - TimePicker minutes to 15

Calling the date time , without initiating the dialog box of Datetime control

I am basically using a datetime control in my application.
Wherein on a click event i am initiating datetime dialog.
In another scenario, i want to move current date, to next day, or previous day.
I don't want the dialogbox of date time control to be displayed.
Is it possible??
The DatePicker and TimePicker controls are available as widgets for you to use in your layouts or code.
You can then build the next day / previous day functionality yourself by setting the date / time of those controls.

Categories

Resources