From 547119db545e93f4046556fac9549a9859c56e25 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 1 Dec 2017 11:11:55 +0530 Subject: [PATCH] timezone change --- .../application/controllers/Batch_Controller.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Apollo/api/application/controllers/Batch_Controller.php b/Apollo/api/application/controllers/Batch_Controller.php index 09156b66..e05fc83f 100644 --- a/Apollo/api/application/controllers/Batch_Controller.php +++ b/Apollo/api/application/controllers/Batch_Controller.php @@ -31,12 +31,15 @@ class Batch_Controller extends REST_Controller { public function addBatchDetails_post() { - + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['BatchCode'] = $this->post('batchcode'); $details['BatchName'] = $this->post('batcheName'); $details['UniversityID'] = $this->post('universityName'); $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); + $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); + $batchDetails = $this->batch_model->addBatch($details);// Check if the users data store contains users (in case the database result returns NULL) if ($batchDetails) { @@ -86,11 +89,16 @@ class Batch_Controller extends REST_Controller { * */ public function updateBatchDetails_post() { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['BatchCode'] = $this->post('batchCode'); $details['BatchName'] = $this->post('batchName'); $details['IsActive'] = $this->post('status'); $details['UpdatedBy'] = $this->post('updatedBy'); - $details['UpdatedOn'] = date("Y-m-d", time()); + $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); + + // print_r( $details['UpdatedOn']) + //exit(); $updateDetails = $this->batch_model->updateBatch($details);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) @@ -112,4 +120,4 @@ class Batch_Controller extends REST_Controller { } -} \ No newline at end of file +}