Answer the question
In order to leave comments, you need to log in
How to change the phone number on the site depending on the time?
It is strange that there is no such solution in the Runet.
The essence is as follows: during working hours from 08:00-17:00, the office phone is shown, and at other times - a mobile phone.
I noticed that targeted calls are missed, and there are no funds to update the PBX yet.
Apparently a simple function in JS, but I'm weak in it. Help me please :)
Answer the question
In order to leave comments, you need to log in
If it's already quite simple for your locality, where date('h') is the server time. You can date('h')+n - where n is the time difference between your location and the server.
<?php
if(date('h') >= 18 and date('h') <= 7){
echo "звоните на мобильный";
} else {
echo "звоните на рабочий";
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question