I have created Behat test case to assert datetime. Datetime has been stored in a UTC format in my database. So, using IntlDateFormatter function to convert back depending on selected locale like en, de or fr.
Issue I am facing is behat test case is working fine in my local machine but on server I have to assert datetime same as database value UTC format.
For example saved value is 2016-01-01 00:00:00. Value showing on site is "01-01-2016 01:00" after convert back to php value from UTC.
On Local assertion working with "01-01-2016 01:00". But on server it's working with "01-01-2016 00:00" not with "01-01-2016 01:00".
Can anyone tell me why behat test case being failed for datetime assertion?
You seem to ignore timezone settings when creating the date.
You'll need to either explicitly define the timezone in all the places you create the date (your code and behat test), or make sure all your environments have the same timezone settings (for php and perhaps the database).
The second option will be probably easier and quicker for you to do. The first is more bullet proof.