Jump to content

Date/Time Help


JaredRitchey

Recommended Posts

I have a batch script that reads from a timestamp.txt file to determine the last time it ran and I need to modify that by two hours.

What happens is the script will run to look for changes in the county records and their server time is two hours different from mine.

 

$fr=fopen("xml/timestamp.txt",'r');
$mydate=fread($fr, 50);
if ($incremental_updates == 1){
$default_template_file="xml/incremental_template.xml";
$default_config_name="xml/incremental.xml";
$contest=file_get_contents($default_template_file);
$contest=str_replace("{DATE_TAG}", $mydate, $contest);
$f=fopen($default_config_name,'w+');
fwrite($f, $contest);
fclose($f);
fclose($fr);
$fw=fopen("xml/timestamp.txt",'w');
fwrite($fw, substr(date('c'), 0, 19));
fclose($fw);
}else{
$default_config_name = "xml/full_update.xml";
}

 

I tried making a time stamp update look like $cur_timestamp=date("Y-m-d H:i:s", time() +14400); which is correct but it doesn't write to the text file properly.

 

Using the above fwrite($fw, substr(date('c'), 0, 19));

I get the correct results in the timestamp.txt file for my server time. I need it to be +14400

 

2011-05-25T08:27:51 would essentially become 2011-05-25T10:27:51 when it writes to the timestamp.txt

 

I hope that makes sense.

 

J

 

 

 

Link to comment
Share on other sites

I realize I may have made that more complex than it needs to be.

 

Here it is in simpler terms.

 

If I do this;

echo substr(date('c'), 0, 19);

 

I can get back this;

2011-05-25T08:45:27

 

I want it to return this;

2011-05-25T10:45:27

 

Which simply adds two hours.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.