> Community: Current Date function
> Community: Help with testing for date?
> FMEpedia: Formating Dates Using the DateFormatter Transformer
Followings are valid representation examples. An attribute value matched with one of these representations can be replaced with formatted date(time) string using the DateFormatter.
(tested in FME 2013 SP4 Build 13547)
-----
now
today
tomorrow
yesterday
last Sunday
next Sunday
next week
next month
next year
last week
last month
last year
2 days
2 weeks
2 months
2 years
2 years 2 months 2 days
2 days ago
2 weeks ago
2 months ago
2 years ago
2 years 2 months 2 days ago
2 seconds
2 minutes
2 hours
2 hours 2 minutes 2 seconds
2 minutes ago
2 hours ago
2 hours 2 minutes 2 seconds ago
-----
Interesting. There could be more variations.
Well, today is Friday 2013-12-13 (Friday the 13th!).
"last Sunday" was replaced with "2013-12-08", it's good.
"next Sunday" was "2013-12-22", but in Japanese, 「次の日曜日」 (means "next Sunday" by literal translation) usually points "2013-12-15". Is there any difference in culture?
中国朋友们,「下星期日」也是"2013-12-15"吧?
=====
2013-12-14: Mark gave me an answer to my last question. See his comment.
English I learned in junior high maybe was British. FME was born in Canada, the mother tongue would be North American English.
In the DateFormatter, just "Sunday" will be replaced with "2013-12-15".
Today is Saturday, 2013-12-14. I got the following results.
-----
Representation | Formatted |
---|---|
last Saturday | 2013-12-07 |
last Sunday | 2013-12-08 |
last Monday | 2013-12-09 |
... | |
Saturday | 2013-12-14 |
Sunday | 2013-12-15 |
Monday | 2013-12-16 |
... | |
next Saturday | 2013-12-21 |
next Sunday | 2013-12-22 |
next Monday | 2013-12-23 |
Probably I use those representations rarely in practical workspaces, but a rarer case should be treated more carefully. Anyway, we have to be aware it when making an appointment in North America.
Thanks, Mark.
From my British point of view I too would say that "next Sunday" is the 15th. But living in North America I've noticed this isn't the case.
ReplyDeleteI tried "This Sunday" without success, and found that simply using "Sunday" produced the required result.
RE: 中国朋友们,「下星期日」也是"2013-12-15"吧?
ReplyDelete这周日(这星期日)是2013-12-15。下周日是2013-12-22。 Baidu/Google seem to agree.
You might want to email me, if you feel that the functionality you posted above is important. The current plan is to deprecate all of the above functionality in an upcoming version of FME. Now is a great chance to have your voice heard on which of the above functionality the new version of FME must have.
Hi Tai, thanks for leaving a comment.
DeleteLong time has passed since we discussed about this issue. Later, I got an idea on how we can explain about the difference.
In Japan and maybe some other countries, most people considers a week starts with Sunday. However, in computer program languages - i.e. North American English culture, a week seems to start with "today".
I think that this is well describing the difference in the "next Sunday". Isn't it?
Today is Saturday, 2016-10-15. If you know that "a week starts with today", you would never be surprised even if FME determined that the "next Sunday" is 2016- 10-23.
I do not think this functionality is so important, so I agree that you plan to deprecate it. However, if you keep the functionality in FME, the most important thing would be that the specifications about how FME determine the date should be documented clearly, I think.
I just realized this functionality has gone :-( it was one of my favorite things, turning 6pm last friday into a correct date/time was great
ReplyDelete