Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Date with time calculation

Featured Replies

Hi there, now i'm creating a task related function. The sample file i attatch have 6 field (Duration, DurationType, StartDate, StartTime, FinishDate, FinishTime). The FinishDate and FinishTime is calculation field. The DurationType contains a value list (Minute(s), Hour(s), Day(s), Week(s), Month(s), Year(s)). User will fill in the first 4 field and then the system will calculate the Finish date and time.

For example if duration is 1 Day(s) and the start date is 12/25/03, then the finish date will be 12/26/03. The time calculation is based on minute and hour.

If user fill in Startdate 12/25/03, time 8:00PM and duration is 7 Hour(s). By right the result would be 12/26/03, 3:00AM. But i can't find a solution to get this result. I only can change the time but the date remain the same.

Regards,

Henry

Date&Time.zip

This is a fun puzzle. I'm just sketching a thought, for lack of time:

First, I'd recommend reducing all durations, via calculation, to number of minutes (there are 1440 in a day). That will allow you to expand your solution so that you could let users enter "1 month and 3 days and 1 hour" and you could still tally the whole thing... Anyway, this field (call it cDurationMinutes, say) will help with solving your problem:

You need to calculate the number of minutes left in the day on which the event is starting. Call it cMinTilMidnight field...

The trick is to divide cDurationMinutes by 1440 AFTER subtracting out the minutes required to get to midnight.

Use Int((cDurationMinutes - cMinTilMidnight)/1440) to get the number of full days to add onto your start date.

Use Mod((cDurationMinutes - cMinTileMidnight)/1440) to get how many minutes are "left over" to spill into that day, for calculating the time.

The rest should be easy wink.gif

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.