Title: Conditional functions by date
Last modified: September 18, 2017

---

# Conditional functions by date

 *  [Laura N](https://wordpress.org/support/users/tallerwp/)
 * (@tallerwp)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/conditional-functions-by-date/)
 * Good morning,
 * I need to know if is possible a conditional from date, for example
 * is_date (1 april 2017 to 1 septiembre 2017){
 * }
 * Thank you

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/conditional-functions-by-date/#post-9505392)
 * Yes it is. You can use timetamp values (from the [date()](http://php.net/manual/en/function.date.php)
   function) or time objects (new [DateTime()](http://php.net/manual/en/class.datetime.php)).
   YOu can use both of these in calculations or comparisons.
 *  Thread Starter [Laura N](https://wordpress.org/support/users/tallerwp/)
 * (@tallerwp)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/conditional-functions-by-date/#post-9506502)
 * Please, can you show me an example as a conditional?
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/conditional-functions-by-date/#post-9507997)
 * Something like this?
 *     ```
       $now = current_time ();
       $then = strtotime( '2017-08-19' );
   
       if( $now < $then ) {
           echo "It's before the time";
       }
       else {
           echo "It's after the time";
       }
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Conditional functions by date’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/conditional-functions-by-date/#post-9507997)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
