Jump to content

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


angelleye
 Share

This topic is 5608 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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 :)-]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

This topic is 5608 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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