I have spent waaaay too long on this and I’m now giving up
Can anyone show me how to extract just the date from this please?
{“patched_date”:“29/04/2024”}
I have tried all sorts of combinations and this is the closest I can get…
Q: following text of position 17 of (lines of file “Desktop\test.txt”)
A: 29/04/2024"}
This ended up being much more complicated than I think it should be, but here’s something that should work until we find something better
q: (it as date) of ((day_of_month (tuple string item 0 of it as integer) as string & " " & month (tuple string item 1 of it as integer) as three letters & " " & year (tuple string item 2 of it as integer) as string )) of tuple string of substrings separated by "/" of "29/04/2024"
A: Mon, 29 Apr 2024
I: singular date
Ah this wont work though as the text file has is exactly as
{“patched_date”:“29/04/2024”}
So the date part needs to be extracted from that full syntax
Ok, you just need to change how the date string is retrieved. For the example I just used a literal string. In this case it looks like the file is JSON format?
q: (it as date) of ((day_of_month (tuple string item 0 of it as integer) as string & " " & month (tuple string item 1 of it as integer) as three letters & " " & year (tuple string item 2 of it as integer) as string )) of tuple string of substrings separated by "/" of (it as string) of value of key "patched_date" of json of file "c:\temp\date.json"
A: Mon, 29 Apr 2024
I: singular date
This was all I ended up needing
Thanks soooo much Jason!
1 Like