S
S
step-olga2015-06-22 12:45:00
PHP
step-olga, 2015-06-22 12:45:00

How to check dates against the current one?

Please help with checking dates. There is a table with users with e-mail and date of birth. How to write a script to check dates with the current date, if it matches, then send a letter of congratulations? The script must run via cron.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
ShamblerR, 2015-06-22
@ShamblerR

Well, for this, the language is not needed, it is enough to bash
in the cron, just throw the script itself, as I understand it, check once a day.
So it will be something like this, say at 8:10 every day
date grep sendmail
will help you with 2 lines of code.
search the file for a line containing the current date pass it to sendmail that's all

A
Alexander Aksentiev, 2015-06-22
@Sanasol

How to write a script? Hands apparently using the keyboard.
Where is the code? That does not work?

A
AVKor, 2015-06-22
@AVKor

Look here .

A
Andrey Mokhov, 2015-06-22
@mokhovcom

SELECT *
FROM users
WHERE date_format(now(), '%m-%d') = date_format(birthday, '%m-%d')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question