Monday, 24 November 2014

PHP date after function

I'd like to stop displaying the variable generate the date after of my events 

Example: We are the 28th June, and I would like to make a code 

If June 28 is not yet past, display "on June 28 by appointment at xxx" 

Solution

You must enter the timestamp of the 28June 

Identify the timestamp of the 29 Juin and set your contiditons:

timestamp_actual = mktime(actual date); 
timestamp 29_juin = mktime(date du 29 juin); 

//  verify syntax for mktime() ! 

if(timestamp_actual < timestamp 29_juin) 
display

E.g: 

$timestamp_actual = mktime(0, 0, 0, 6, 28, 10); 

  
$timestamp_xxx1 = mktime(0, 0, 0, 6, 27, 10);  
$timestamp_xxx2 = mktime(0, 0, 0, 6, 29, 10);  
  

if($timestamp_actual < $timestamp_xxx1)  
echo "apointment on the 27 at xxx1"; 


if($timestamp_actuel < $timestamp_michou)  
echo "apointment on the 29 at xxx1"; 

0 comments:

Post a Comment