Jump to content

Determining Date Format when Parsing JSON data?


Recommended Posts

My JSON data contains dates in one of three formats:

YYYY
YYYY-MM
YYYY-MM-DD

The field is: Items::Initial_Release

Instead of the text, I would like to have it display that as a proper date based on what's there.

1984:               Year Only
1984-08:         August, 1984
1984-08-08:   08 August, 1984

Based on the available options for formatting the date, I gather that the FileMaker Date format probably can't deal with less than the full amount of data? Or even changing it, having it be Day first if there is full data, otherwise Year, or Year, Month only.

1222950954_ScreenShot2020-10-12at03_45_21.png.85048edf56b300d856c52e612643accf.png

Otherwise, it looks like I would have to have the date field in three different formats and use Hide If .. the data is 4 characters, 7 characters, or 10 characters?

As well, no matter what I do with those format settings above, I can't enter anything less than 10 characters in the field if it's defined as a date field.

I'd like to be able to get things by date in queries, so keeping it as date format would seem to be the better way to make that work.

Link to post
Share on other sites

Only date fields can be formatted as dates - and a date field must contain a full date (i.e. a specific day in a specific month in a specific year) in order to be valid. 

There are several ways to handle partial dates (e.g. separate fields for day, month and year). In your example, it seems the simplest way would be to keep the original "date" in a Text field, and make your own calculation field to display it the way you want.

 

Link to post
Share on other sites

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
×
×
  • Create New...

Important Information

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