2012-11-25 4 views
1

하지만 난 통지를 보내려면 cron 작업을 통해 30 분, 15 분 또는 5 분크론 작업 약속 시간 전에 5 분 약속 시간이</p> <p>오후 4시 반입니다 예를 들어 시간의 차이를 찾을 수있는 방법을

오후 4시 반

전에하지만 난 문 가 전 경우 집합에 대해 통지 할 경우 내가을 할 수 있도록 시간 차이를 가져 오는 방법을 알아낼 질수 30 분이 지나면 이메일이 오후 4시에 전송됩니다.

,363,210

예 : 당신이 - $setting을하고 일을 기대하지 수

$setting = "30 minute";//set to notify 30 min before appointment 
$notiftime = "4:30 PM";//time of the appointment 

$notiftime = strtotime($notiftime); 
$difference = strtotime('-' $setting , $notiftime); 

$current = date('h:ia'); //gets current time 
$current = strtotime($current); 

if ($current <= $difference){ 

//send email script======= 

} 
+1

은 무엇인가'storetime()'당신은 문자열 자체에 -를 추가해야? –

+0

죄송합니다. 오타입니다. – telexper

+0

은 데이터베이스에서 오는 시간 값입니까? – Cups

답변

1

당신이 원하는 무엇 :

$appointment = "4:30 PM";//time of the appointment 
$delay = 30 * 60; //set to notify 30 min before appointment 

$appointment = strtotime($appointment); 
$notifytime = date('h:ia', $appointment - $delay); 
+0

나는 PHP와 cron 직업을 통해 이것을하고있다 – telexper

+0

@telexper How that that? – didierc

+0

기다려주세요. – telexper

1

$setting은 문자열입니다.

다음
$difference = strtotime('-' . $setting , $notiftime);