This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
coding:what_year [2025/03/26 22:37] admin |
coding:what_year [2025/03/26 22:39] (current) admin |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== What Year? ====== | ===== What Year? ====== | ||
| - | Someone in passing mentioned they had a project that could tell them the year of a vintage gig poster - I'd already built something into a bot to answer something similar, if I saw a poster in a bar and wondered if it was upcoming or not, I could ask "Adelaide is Fri Dec 1st this year?" and get a yes or no. | + | Someone in passing mentioned they had a project that could tell them the year of a vintage gig poster - I'd already built something into a bot to answer something similar when I was working on an events project, if I saw a poster in a bar and wondered if it was upcoming or not, I could ask "Adelaide is Fri Dec 1st this year?" and get a yes or no. |
| Due to how the string to time function in PHP works, it's not too difficult. Here is an expansion of the code to work for either a "day month date" or even just a "date month". | Due to how the string to time function in PHP works, it's not too difficult. Here is an expansion of the code to work for either a "day month date" or even just a "date month". | ||
| + | |||
| + | For example if the poster has "Playing Tuesday 31st December" you can tell which year, and if it just has "Playing this Tuesday 31st" you can make a guess: | ||
| <code php what_year.php> | <code php what_year.php> | ||