Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why my date column always return int value?. How can I get the origin value? because its int value is wrong. #1978

Closed
TheThai212 opened this issue Jan 2, 2019 · 10 comments

Comments

@TheThai212
Copy link

ex:

  • my date column: 12/20/2018;
    when i dd($row['date']) it return 43454.705023148
    and it is not the value of 12/20/2018 when converted to a int. it is "1970-01-01 20:04:14"
    how to fix it? thanks!
@ghost
Copy link

ghost commented Jan 2, 2019

Thanks for submitting the ticket. Unfortunately the information you provided is incomplete. We need to know which version you use and how to reproduce it. Please include code examples. Before we can pick it up, please check (https://github.com/Maatwebsite/Laravel-Excel/blob/3.1/.github/ISSUE_TEMPLATE.md) and add the missing information. To make processing of this ticket a lot easier, please make sure to check (https://laravel-excel.maatwebsite.nl/docs/3.1/getting-started/contributing) and double-check if you have filled in the issue template correctly. This will allow us to pick up your ticket more efficiently. Issues that follow the guidelines correctly will get priority over other issues.

@TheThai212
Copy link
Author

TheThai212 commented Jan 2, 2019

I'm using laravel excel 3.1 and php 7.1

@GlennM
Copy link
Contributor

GlennM commented Jan 2, 2019

Please fill in the issue template with all the required information if you would like to receive support.

Based on the info now, I'd suggest reading https://laravel-excel.maatwebsite.nl/3.1/exports/column-formatting.html / https://laravel-excel.maatwebsite.nl/3.1/imports/custom-formatting-values.html and see if that helps.

@enltguy
Copy link

enltguy commented Jan 2, 2019

$now = date('m/d/Y')

@MacDino
Copy link

MacDino commented Jan 3, 2019

yeah i have the same question .
i'am reading https://laravel-excel.maatwebsite.nl/3.1/imports/custom-formatting-values.html and try to use bindValue to fix it .but it not work.
i find someone commit a bug maybe find why #1907

@patrickbrouwers
Copy link
Member

PhpSpreadsheet doesn't support value binders on imports. This is a mistake in our documentation.

For date conversion, you are most likely dealing with an excel timestamp. You can try to convert using:

\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row['date'])

@TheThai212
Copy link
Author

i just delete old value and format this column in Category:custom yyyy-mm-dd. it's working.

@insign
Copy link

insign commented Feb 14, 2019

PhpSpreadsheet doesn't support value binders on imports. This is a mistake in our documentation.

For date conversion, you are most likely dealing with an excel timestamp. You can try to convert using:

\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row['date'])

This was a lifesaver after a lot of research

@arunandroapps
Copy link

PhpSpreadsheet doesn't support value binders on imports. This is a mistake in our documentation.

For date conversion, you are most likely dealing with an excel timestamp. You can try to convert using:

\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row['date'])

This solution is not working if we're taking the date in the format of mm/dd/yyyy from Excel, is there any other trick for mm/dd/yyyy???

@vinaynarendrapeeta
Copy link

Hello, I am using Laravel 9 and Laravel-excel is 3.1. In the excel sheet, in one field only i need to take all datatype values. and also how to check whether it is date or integer value getting from excel sheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants