We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Compare Dates give me a warning

Development and Programming

ahmadalashhab's avatar
ahmadalashhab
18 posts
7 years ago
ahmadalashhab's avatar ahmadalashhab

Hi all ,

I’m trying to compare my custom field date with the current time but it’s give me a warning ” array_flip(): Can only flip STRING and INTEGER values! “

My Code

{if "{custom_field_date format='%d %m %Y'}" >=  "{current_time format='%d %m %Y'}" }

Any help ?

Thanks ..

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

Hey ahmadalashhab, looks like you may have found a bug. However, I don’t think your conditional will do what it looks like you are trying to do. %d %m %Y will output something like 17 04 2018, which is not suitable for a >= comparison. If you just wanted to see if your custom date is greater than or equal to the current time, you can use:

{if custom_field_date >= current_time}
       
ahmadalashhab's avatar
ahmadalashhab
18 posts
7 years ago
ahmadalashhab's avatar ahmadalashhab

Hi Derek ,

Thanks for your replay , it’s seems that your code doesn’t work correctly , it’s doesn’t give me correct results.

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

Can you describe how it’s not working for you? You’ll need to be more descriptive for anyone to help.

Some things to check:

  • server is set to the correct time and timezone
  • PHP environment is configured to the correct timezone
  • ExpressionEngine is configured to the correct timezone
  • Logged in member’s localization is configured to their correct timezone
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.