13

How to get the Excel date using the PHPExcel library

 3 years ago
source link: https://www.codesd.com/item/how-to-get-the-excel-date-using-the-phpexcel-library.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to get the Excel date using the PHPExcel library

advertisements

I am trying to get Date from excel using PHPExcel. But I am not getting date, I am getting string value which is not seconds from 1970 .

Code I have tried is

$InvDate=trim($excel->getActiveSheet()->getCell('B' . $i)->getValue());


Try use

$cell = $excel->getActiveSheet()->getCell('B' . $i);
$InvDate= $cell->getValue();
if(PHPExcel_Shared_Date::isDateTime($cell)) {
     $InvDate = date($format, PHPExcel_Shared_Date::ExcelToPHP($InvDate));
}

@DiegoDD: Should mention that $format is the desired format for the date. e.g.:

 $InvDate = date($format = "Y-m-d", PHPExcel_Shared_Date::ExcelToPHP($InvDate));

Related Articles

How to get a sqlite date used on the Android app

tv=(TextView)findViewById(R.id.textView1); SQLiteDatabase sqLiteDatabase = SQLiteDatabase.openOrCreateDatabase("/sdcard/assets.db", null); Cursor c=sqLiteDatabase.rawQuery("select datetime('now')", null); if(c.moveToFirst()){ tv.setTex

how to add the PHPExcel library to laravel?

i want to create new module in laravel which include PHPExcel library. where to put library. how to access it. i have put the PHPExcel library at below location laravel\project\application\libraries\PHPEXCEL it give me error PHP Fatal error: Class 'P

How to get JSON / JSONP data using the local XAMPP server?

I have set up a local server using XAMPP. Now I want to get JSON / JSONP data from that server. Side question: Do I need to somehow upload the JSON file on the server? Or is there somePHPcoding for that? IF yes, which? I have heard about some jQuery

Selenium webdriver: How to get embedded image data using JavaScripts?

I have to get the src from below mentioned html, please let me know how can I get the embedded image data? Is this possible using JS? If there is any way to show to the hide elements? I am using Selenium web driver with Java. <div id="sc859"

How to get exact json data using python

I'm getting an error trying to parse json file { 0: { 'data': [ { 'state': 1, 'invitation_sent_at': None, 'group_id': None, 'firstname': 'goog', 'company': 'wbru', 'member_of': None, 'updated_at': '2017-07-21T08:07:45.375Z', 'last_login': None, 'mana

How to get more search data using binary search?

First of all I apologize for my english and this is my first time asking on stackoverflow so if i miss something please point it out. So I'm new to java and trying out binary search with the help from my friend. The code is to display product informa

How to get JSON URL data using angularJS

**This is my service.js file. this code not working what is the wrong. And how to create service file. This links will execute category list with product. The scenario is when click on the category I need to show products. ** angular.module('director

How to get Exif image data using OpenCV?

Does OpenCV support getting Exif data of images? Is there a program in OpenCV that parses the Exif data and get appropriate fields?OpenCV has no Exif support. It's not the purpose of OpenCV.

How to get dynamic json data using check boxes in angularjs?

I am struggling so much and find so many links and articles but can't get solution. I have an array like that $scope.cols=[ {"dpname":"partname","search":'',"qparam":''}, {"dpname":"partid","

How to get Last Day data using Date Object in JavaScript?

I am working to filter data. Filter will be Last Day, Last Week, Last Month. My code is : For Last Week : dateUntil = Date.now(); dateSince = date.setDate(date.getDate()-7) Last Month : dateUntil = Date.now(); dateSince = date.setDate(date.getDate()-

How to get the value of a cell at a specified position in an excel sheet using JAVA

How to get the value of a specific cell from a .xlsm file using java ..?? I want to fetch the cell value by specifying the particular row and column for example i need the cell value at row 1 and column C1 or row5 and column C6 ... I am getting the v

How to get the data collection from these json data using newtonsoft json.net in c #

how to get the data section in a loop to get the id name and type from this json data format in c# json.net { "reactions":{ "data":[ { "id":"201852446499743", "name":"Kalna@kalna", "type&quo

How to get the selected date value using Bootstrap Datepicker?

Using jquery and the Bootstrap Datepicker, how do I get the new date value I selected using the Bootstrap Datepicker? FYI, I'm using Rails 3 and Coffescript. I set up the datapicker using: <input id="startdate" class="span2 datepicker&qu

how to get the value of a name defined in another workbook, using vba for Excel

I have several workbooks containing calculations and I am making an "automatic overview" combining the data in all those sheets. To find the data I use named ranges. These work fine. However there is one defined name that does not refer to a ran

How to get the name of the day using a particular date in Android?

I have date string 18-2-2012 , from this how to get the current day name i.e., today is "saturday" like this. for tomorrow's date 19-2-2012 and the day name is "sunday".Use java date formats. SimpleDateFormat inFormat = new SimpleDateF

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK