Can anyone help me how can I create a php file to bring in the time and date? Well I have a case that php is taking a divergent time, I checked the php.ini, that's correct. I want to create a php test file to check.
Can anyone help me how can I create a php file to bring in the time and date? Well I have a case that php is taking a divergent time, I checked the php.ini, that's correct. I want to create a php test file to check.
If you are picking a date / time different from the current one, it is a time zone problem.
Put this line at the beginning of your script:
date_default_timezone_set('America/Sao_Paulo');
Hugs!
It's simple to create a PHP file with the date and time, you can do so:
<?php
//nome do arquivo
$name = 'arquivo.txt';
//texto que estará escrito dentro do arquivo com a data e a hora
$text = date('d/m/Y H:i:s');
//aqui ele cria o arquivo, você pode criar em um lugar especifico, concatenando um caminho em name;
//sem caminho
$file = fopen($name, 'a');
//com caminho
$file = fopen('caminho/aonde/quero/'.$name, 'a');
//escreve
fwrite($file, $text);
//salva o arquivo
fclose($file);
?>
Just to complement:
Well I'm having a case that php is picking up a divergent timetable
It may be that the default date is not the same as the server, maybe the code should help:
date_default_timezone_set('America/Sao_Paulo');