Slack Based Greeting
Always know the proper greetings in Slack
Frequently I talk to offshore team members in Slack. The problem that I encounter is that I don't know the time of day its at their location - is it Morning, Afternoon or Night time? So should I say good morning or good evening?
I have a Keyboard Maestro and PHP it makes it real easy to say the proper introduction regardless of where they are in the world.
Real World Example
There is a macro in my library for 'ggi' and this will automatically display the correct greetings when I am talking to my India team in chat. So if it's night time, it would say 'Good Evening' and if it's before 6 pm their time, 'Good Afternoon.' I have similar macros for ggsfo, ggj and ggk .
Now I will always say the correct greetings, I just need to remember where they are located.
This is the PHP code that I use to get that done:#!/usr/bin/php <?php date_default_timezone_set('Indian/Mauritius'); function greeting(){ $timeOfDay = date('H'); if($timeOfDay > '17'){ return 'Good evening. '; } else if ($timeOfDay > '12'){ return 'Good afternoon. '; } else { return 'Good morning. '; } } echo greeting(); ?>
You can see the thing that makes the difference is the PHP's date_default_timezone_set function.
This is what the Macro looks like in Keyboard Maestro, your best to use whatever string command works best for you: