0
Thanks

A few words of thanks would be greatly appreciated.

PHP - date after function




Issue


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"; 


Thanks to azerty0 and cedfid for this tip.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « PHP - date after function », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

0 Comments