Hi all,
I'm stumped on this one, though think there's got to be an easy solution.
I'm working on a dataset of metadata for photos (from this amazing collection:
http://sfmta.photoshelter.com) and I'm trying to parse out the dates as the date fields are sometimes mixed up. It turns out that the description field has the most accurate dates reported, and they look like this:
Curve in New Track Ferries and Cliff Line | April 7, 1905
Sutter Street Powerhouse Boiler Room | Circa 1905
End of Streetcar 1074 | April 1905
So I've written this to get at most of them, though it doesn't work for the Circa 1905 variants.
if(value.split(' | ')[1].contains('Circa'),
toString(toDate(value.split(' | ')[1].split(' ')[1]
+ ' 1, '
+ value.split(' | ')[1].split(' ')[2]), "yyyy-MM"),
if(value.split(' | ')[1].contains(',')
, toString(toDate(value.split(' | ')[1]), "yyyy-MM-dd")
, toString(toDate(value.split(' | ')[1].split(' ')[0]
+ ' 1, '
+ value.split(' | ')[1].split(' ')[1]), "yyyy-MM")))
Wonder if anyone has any thoughts on a better approach?
Thanks! Jon