1

I encounter this issues when I'm trying to play with date time in PHP (in CentOS). Thus, I am quite confused regarding this matter.

$time = @date('[d/M/Y H:i:s]');

The code run well enough without warning. Meanwhile, for

$time = date('[d/M/Y H:i:s]');

It produces below warning:

Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelt the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone

Both:-

  1. I try not use date_default_timezone_set() function for try and error purpose.
  2. will write the result [15/Dec/2016 07:03:43] into log.txt file.

What exactly happens? I didn't find anything regarding the first code.

Salehin Rafi
  • 351
  • 2
  • 6
  • 16

1 Answers1

1

PHP Documentation

PHP supports one error control operator: the at sign @. When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.

You can read more here : Error Control Operators

KodeFor.Me
  • 13,069
  • 27
  • 98
  • 166