MyChat Scripts: function mGetBirthdayUsers, get birthdays by specified date and month
Getting the list of users whose birthdays match a specified date and month. Using only those users who specified their birthdays in a profile, an account is active (not blocked), and any rights group (except WEB guests).
Syntax
function mGetBirthdayUsers(dt: double): string;
Parameters and return values
Parameter |
Type |
Value |
dt |
double |
date used for getting the list of birthday users (date and month). |
Function result
A list of users' UINs divided by commas. If there are no such users, then it returns an empty string.
Example
Specify days with 2 or more birthdays, and get the list of their UINs.
var
dt: double;
i: integer;
s: string;
begin
dt := EncodeDate(2021, 1, 1);
for i := 0 to 364 do begin
s := mGetBirthdayUsers(dt);
if (length(s) > 0) and (StringCharsCount(s, ',') > 1) then mLogScript(s, FormatDateTime('mmm dd', dt));
dt := IncDay(dt, 1);
end;
end.
Script work result
[22:22:54] (Log "mGetBirthdayUsers"): [jan. 01] 11887,12100,15422,16294,17614
[22:22:54] (Log "mGetBirthdayUsers"): [jan. 18] 12477,15969,16658
[22:22:54] (Log "mGetBirthdayUsers"): [feb. 22] 13126,21355,21896
[22:22:54] (Log "mGetBirthdayUsers"): [mar. 17] 10991,11998,13608,15709
[22:22:54] (Log "mGetBirthdayUsers"): [apr. 22] 12470,13973,14010,14294,14456,14558,15018,15794
[22:22:54] (Log "mGetBirthdayUsers"): [jun. 04] 11576,13236,16701
[22:22:54] (Log "mGetBirthdayUsers"): [jul. 28] 11146,14620,19067
[22:22:54] (Log "mGetBirthdayUsers"): [sep. 03] 16422,16702,16713
[22:22:54] (Log "mGetBirthdayUsers"): [sep. 12] 10895,11325,14272
[22:22:54] (Log "mGetBirthdayUsers"): [oct. 09] 6,5454,12771
[22:22:54] (Log "mGetBirthdayUsers"): [oct. 31] 11589,16665,16669
[22:22:54] (Log "mGetBirthdayUsers"): [dec. 17] 12550,13160,21313
[22:22:54] (Run "mGetBirthdayUsers"): Script operation time: 298 ms
[22:22:54] (Run "mGetBirthdayUsers"): Script done successfully.