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.

Can anyone explain this? (date/time conversion)

Featured Replies

This is just an example to demonstrate my problem...

 

getastimestamp( getasnumber((timestamp(date(1;1;2001) ; time(0;0;0)))) )

 

returns 1/01/2001 00:00

 

 

getasdate( getasnumber((timestamp(date(1;1;2001) ; time(0;0;0)))) / 86400 )

 

returns 31/12/2000 (Australian formatted date)

 

 

Am I missing something obvious?

Using FMPA 12.0v3

 

 

Solved by David Jondreau

Go to solution

Looks like you're missing about a day's worth of seconds. I'm not sure what exactly is going on here, but I think it's a "mythical" problem, based on our not understanding how FileMaker is counting days and seconds.

 

What is your actual problem? Whatever it is, I think you're better off not not dividing by 60*60*24, but simply using GetAsDate.

 

GetAsDate ( Timestamp ( Date ( 1 ; 1 ; 2001 ) ; Time ( 0 ; 0 ; 0 ) ) ) returns the result you're expecting.

  • Author

Thanks for reply David

I was trying to round a timestamp to the nearest hour then separate it into date and time.

 

I've figured out how...

 

Set Variable [$now; Value:Get( CurrentHostTimeStamp )]
Set Variable [$RoundedDate; Value:GetAsDate( GetAsTimestamp( Round( $now /3600 ; 0 ) *3600 ) )]

Set Variable [$RoundedTime; Value:Time( Round( GetAsTime( $now ) /3600 ; 0 ) ; 0 ; 0 )]

 

I'd still welcome better ways if any.

  • Solution

This may be a little clearer...

 

Set Variable [ $now ; Get ( CurrentHostTimestamp ) ]

Set Variable [ $round.now; GetAsTimestamp ( Round ( $now / 3600 ; 0 ) * 3600 ) ) ]

Set Variable [ $date ; GetAsDate ( $round.now ) ] 

Set Variable [ $time ; GetAsTime ( $round.now ) ]

So if it is 23:55 on the 1st of Jan, then it should round up to 2nd of Jan?

  • Author

This may be a little clearer...

 

Set Variable [ $now ; Get ( CurrentHostTimestamp ) ]

Set Variable [ $round.now; GetAsTimestamp ( Round ( $now / 3600 ; 0 ) * 3600 ) ) ]

Set Variable [ $date ; GetAsDate ( $round.now ) ] 

Set Variable [ $time ; GetAsTime ( $round.now ) ]

Slightly, thanks David

So if it is 23:55 on the 1st of Jan, then it should round up to 2nd of Jan?

Yes

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.