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.

Is there a way to subtract hours from a timestamp field...???

Featured Replies

I've got a timestamp field in FM that a script is bringing in as GMT and it's 5 hours ahead of my actual time. Is there a way in FM to subract 5 hours from whatever is in that field so that it's correct for our time zone?

Any info would be greatly appreciated. Thanks!!

A timestamp field is basically seconds, a lot of seconds. Look at one as GetAsNumber(timestamp field) to see.* So you'd subtract 5*3600.

*Format, Number.. "Leave data formatted as entered" to see as a regular number. It's currently: 63289723473, getting late :)-]

  • Author

Where do I add that subtraction? Forgive me...I'm new to FM. Developing for a client who uses it. I'm looking in the options for the field but I don't see anything that looks like what you're saying.

Another option - use a field (number) to hold the GMT so you can shift it by daylight savings etc. It can be global (if stored when standalone). Then create a calculation (result is timestamp) =

timestampField - GMT * 3600

If you don't want a GMT field, it would be:

timestampField - 5 * 3600

  • Author

ok, actually it looks like I figured it out for new records that get added...

Auctions::Auction_Timestamp_Start_Local - (5 * 3600)

and I unchecked the box that says "Do not replace existing value for field(if any)" but it's not changing all of the records that already have field populated.

How can I make that happen?

You can remove those parentheses - you don't need them because multiplication and division always comes before addition or subtraction - and multiplication applies only to the number immediately preceeding. So 3600 only multiplies (sees) the 5 without isolating it.

You can kickstart your auto-enter calculated standard timestamp field by changing the type to CALCULATION. When the calc dialog opens be sure to change below from number to timestamp. Do NOT make it unstored in the Storage. Say OK then OK to back clear out of field defintions. Then go back into define fields and change it from calculation back to standard timestamp field. Select Options and your calculation will still be there (under auto-enter tab). Back out of field definitions. This will force an update. BACK UP FIRST! :wink2:

  • Author

Cool. Thanks for the info!

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.