Using an IF function to manage due dates across multiple time zones

#1

Hi, I am working on an Airtable base that serves as an editorial calendar for analysts operating around the globe. I have been struggling to figure out the best way to configure due date fields so they are meaningful to everyone on our team.

My current experiment is to disable “use the same time zone (GMT) for all collaborators” in the due date field, which allows every user to enter and view due dates in their local time. However, this requires formatting the due date as a date/time field, in which the time defaults to midnight. Our people will rarely enter a due date time, and I would like to be able to default a non-entry to 8:00 AM, so that it is more clearly aligned with working hours. Note: there are infrequent occasions when we do need to enter an actual release time, to be understood in the time zone of the local user.)

I have been trying an IF formula that references the Due Date field, but am having trouble configuring it correctly. If anyone has experience building successful IF formulas that reference Time in a Date field, I’d be much obliged for by advice you can give.

These were some things I tried. The due date field is named “Release Date Local Time”.

IF({Release Date Local Time = “12:00am”), “8:00am”, “Time entered”)
IF({Release Date Local Time} Time = “12:00am”), “8:00am”, “Time entered”)
IF({Release Date Local Time} TIME = “12:00am”), “8:00am”, “TIME entered”)

All these and a lot of other iterations resulted in error messages.

0 Likes

#2

Hi @Kate_Sopko - I wonder if this works for you? I’ve taken a slightly different approach.

Have two fields - Due Date (of type date, but no time element) and Due Time (of type Single Line Text with a default value of ‘08:00’.

18

When you create a new record the time element will default to 08:00 and you can override this on the occasions you need to.

Then use two additional fields to get these into the format you want:

Due Date/Time as STR uses the formula:

CONCATENATE(DATESTR({Due Date}), ' ', {Due Time})

and turns the due date and time fields into a single string.

DATETIME_PARSED then converts the string into a real date/time using:

DATETIME_PARSE({Due Date/Time as STR}, 'YYYY-MM-DD HH:mm')

Of course, maybe the last two columns are not required if you don’t need to further manipulate the dates and the Due Date and Due Time fields may be sufficient.

JB

1 Like

#3

Hi Jonathan,

This is a great set of code, and I very much appreciate you sending it.

However, I think it doesn’t solve for allowing our users in different time zones to enter/view due dates in their local timezone rather than in GMT.

As far as I’ve been able to understand, this requires setting up the Due Date field with a time function and toggling off the “Use the same time zone (GMT) for all collaborators” function.

Am I missing something on this? Very well could be :slight_smile:

Thanks,

Kate

0 Likes

#4

Hi Kate - I may have misunderstood your original comments - I read it to be that whether someone is in San Francisco or London or Sydney, they are only working with their local time, but reading it again are you saying that if you set the release date/time to, for example, 4th April 08:00 GMT you want someone in Sydney to understand this as 4th April 08:00 + 11 hours (or 4th April 19:00)?

I think this might be possible with the formula:

SET_TIMEZONE([date], [tz_identifier])

But for this to work I think you’d need to assign each task to a person and the person has an associated timezone.

JB

0 Likes

#5

@Kate_Sopko - let me know if this was what you were thinking of and I’ll see if I can get it to work

JB

0 Likes

#6

Hi Jonathan,

What you’re describing could be a possible solution.

Every one of our reports (editorial flow for report production is what we’re tracking in this calendar) is assigned to at least one author, and those authors are all associated with time zones. When authors team up, it’s typically within the same time zone. Right now, Reports link to a table called
“Team” to assign authors to each report. The Team table is a simple table of author/editor names and contact info.

I had been thinking it might be possible to assign a time zone to each Team Member within the Team table itself, but from there, I am not certain how to make time zones associate with each report they’re authoring… I can send screenshots if that’s at all helpful.

Thank you so much!

Kate

0 Likes

#7

Hmmm…well I thought this would work, but I’m getting errors. Posting where I’ve got to in case someone else can add to it.

My idea, which I think matches with your last comment @Kate_Sopko, was to have two tables - people and tasks (this is probably a lot more simplistic than you have, but hopefully the principles are the same).

In “people” we have a name and a timezone:

The timezone has to be one of the identifiers here:

Then in my tasks table, I assign a task to a person and do a lookup to the timezone:

I’ve then got various fields, most of which are described above, that allow you to set the GMT date and time, defaulting to 08:00, but overriding where required:

The last column, “local date time” is the “date time parsed” converted to the timezone of the assignee. Except that it isn’t working. If I use this formula for the local date time:

DATETIME_FORMAT(SET_TIMEZONE({Date Time Parsed}, {TZ}), 'M/D/YYYY HH:mm')

I get an error. I cannot get the TZ value into the formula dynamically. I know it works because if I hard-code this to ‘Australia/Sydney’ it works:

DATETIME_FORMAT(SET_TIMEZONE({Date Time Parsed}, 'Australia/Sydney'), 'M/D/YYYY HH:mm')

I’m guessing this is something to do with the SET_TIMEZONE requiring the timezone value to be quoted. But even if I quote it in its field or in the formula it doesn’t work. :frowning_face:

Here’s the link to my mockup:

JB

0 Likes

#8

A lookup field doesn’t return a string. It returns an array, even when returning a single item. When referencing the contents of a Lookup field from a formula, Airtable defaults to leaving it as an array. To force it to be a string, you need to concatenate it with a string. Try this:

DATETIME_FORMAT(SET_TIMEZONE({Date Time Parsed}, '' & TZ), 'M/D/YYYY HH:mm')
1 Like

#9

Hi @Justin_Barrett - perfect! Just what I needed. A slight correction to your formula:

DATETIME_FORMAT(SET_TIMEZONE({Date Time Parsed}, '' & TZ), 'M/D/YYYY HH:mm')

(no curly braces around the '' & TZ )

Thanks!

JB

0 Likes

#10

Oops! I think I was more tired than I realized last night. I put the quotes inside your original curly braces surrounding TZ. I’ll fix my post now.

1 Like

#11

Many thanks to you both, and an apology for a delayed response. Our office is in the middle of a move, so have not had time to dig back into this problem. I will try this out today and let you know if it works. Very much appreciate your help here!


Virus-free. www.avast.com

0 Likes

#12

Hello Jonathan and Justin,

Can’t thank you enough for you help on thinking this through! I am very close to making this work, but ran into issues right at the end. Here’s what I did with your excellent advice:

In our Team Table, I entered the Timezone (in Airtable format) for each of our authors.

In our Reports Table, I:

  • changed the Release Date field to not include a time.

  • set up a Due Time field with the default at 08:00 AM like you had it. Worked great.

  • followed the instructions on CONCATENATE(DATESTR and DATETIME_PARSED, which both worked great.

  • created a Lookup field that looks up the Timezones of Authors associated with each Report. Worked.

  • I then created an ARRAYUNIQUE on the Timezone Lookup field to eliminate showing several time zones when there are several authors.

  • This worked, with the exception of 2 Reports where 2 authors are working in different time zones. I think I will deal with this by having a lead author and co-authors in separate fields when authors are working in different geographies.
  • When I got to translating the Deadline into the Timezone of the author, I am getting an error message (which is not surprising, as I set this up a little differently than you did.)

Here’s what I tried. (I did this and a couple other iterations of it. None worked.)

DATETIME_FORMAT(SET_TIMEZONE({Date Time Parsed}, {’’ & TZ}), ‘M/D/YYYY HH:mm’)

If you have any insight, I’m all ears.

Ideally, if that time zone translation can work, I’d like to then format the deadline into ‘Friendly’ format, as that works for all our users’ date format preferences.

I was able to successfully apply the following to the Date Time Parsed field, and am hoping to be able to apply it to the deadline translated into timezones, if any of us can figure out how to make that work.

DATETIME_FORMAT({Due Date and Time}, ‘LLL’)

Thanks again for all your help!


Virus-free. www.avast.com

0 Likes

#13

@Kate_Sopko, you seem to have repeated that little inadvertent mistake from above where you have your concatenation inside curly braces.

Try this:

DATETIME_FORMAT(SET_TIMEZONE({Date Time Parsed}, '' & TZ), 'M/D/YYYY HH:mm')
1 Like

#14

Yep, curly braces :slight_smile:

Also to note (I wasn’t clear from your last comment how you finally had it set up) that the SET_TIMEZONE formula will only work on a single timezone identifier - if you pass through multiple timezones (with the unique array formula) SET TIMEZONE doesn’t work (it doesn’t error either as far as I can see, just doesn’t work).

JB

0 Likes

#15

@Kate_Sopko - your friendly date formula seemed to work fine for me:

DATETIME_FORMAT({Due Date and Time}, 'LLL')

0 Likes

#16

Yes, I happened to see that after the fact! Thank you, it ended up working well!


Virus-free. www.avast.com

1 Like

#17

Thanks, yes, I decided to go revise our structure to have just one lead author on every report in order to eliminate that issue. It’s working great, and I couldn’t have done it without your help!


Virus-free. www.avast.com

0 Likes

#18

Yeah, it did the trick! I am having one last problem here. We use these due dates in a Calendar View, and I’d like to have the Die Dates as translated into the local time zone be what shows up on the Calendar rather than the GMT time which is often a different day for many of our users.

I think this can be done through DATE_TIME PARSE?

I tried these formulas

DATETIME_PARSE({Release in Local Time}, ‘YYYY-MM-DD’)

and

DATETIME_PARSE({Release in Local Time}, ‘YYYY-MM-DD HH:mm’)

and got error messages with both.

Sorry for so many questions!


Virus-free. www.avast.com

0 Likes

#19

Hi @Kate_Sopko - So to get this to work, I need to create a new date field for the calendar view (which I think is what you are saying). DATETIME_PARSE is the right formula, but you specify the format of the date you are inputting to the formula (not the output format). DATETIME_PARSE always outputs dates in the same format:

M/D/YYYY h:mm a

So, on my example base, I created a new field “Calendar Date” and the formula for this was:

DATETIME_PARSE({Due Date and Time}, 'M/D/YYYY H:mm')

Where M/D/YYYY H:mm is the format of {Due Date and Time}

Does this fix the problem?

JB

1 Like

#20

That totally worked. I had a combination of problems-- date format, as you noticed, was off, and I also needed to be applying the formula to the formula field, not the one I’d formatted for Users to look at.

This is working great now. Many thanks!

1 Like