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.

Bad Date Calc

Featured Replies

Hi--

I have upgraded a database from 6.0 to 7.0 and am having a problem with a date calc field. The calc is supposed to handle a date which is entered in the format:

5/03/03 11:51:24 PM EST

And have the result of date:

5/03/03

The calculation is as follows. The first part handles dates which were entered in another format before the present format had started to be used. The second handles the current format:

EDITED (sorry about that!):

If(MiddleWords(Enter Date;2;1) =  "Feb"  and GetAsNumber(LeftWords(Enter Date;1)) 

<= 15 or MiddleWords(Enter Date;2;1) =   "Jan"; GetAsDate(If(MiddleWords(Enter Date;4;1) >= 24; 

Case(MiddleWords(Enter Date;2;1) = "Jan";"1";MiddleWords(Enter Date;2;1) = "Feb"; "2";"3") & "/" & 

GetAsNumber(LeftWords(Enter Date;1)-1) & "/2002"; 

Case(MiddleWords(Enter Date;2;1) = "Jan";"1/";MiddleWords(Enter Date;2;1) = "Feb"; "2/";"3/") 

&  LeftWords(Enter Date;1) & "/" & "2002")); 

Date(LeftWords(Enter Date;1);MiddleWords(Enter Date;2;1);MiddleWords(Enter Date;3;1)+2000) )

This calc worked fine in 6.0, but in 7.0 is coming up as nothing but invalid dates. But the weird thing -- only for *new* entries. All the old records have valid dates in them.

As well, I tried entering an old date which is showing a valid result in a previously entered record (the one in the above example) in a new record, it too comes up as invalid.

What am I doing wrong?

The word-splitting rules have changed in FM7.

In FM6,

  • Author

Yep -- that did it!

Thanks smile.gif

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.