Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7517089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:20:10+00:00 2026-05-30T01:20:10+00:00

I am trying to upload an excel spreadsheet with a column that contains dates

  • 0

I am trying to upload an excel spreadsheet with a column that contains dates and also other text.

the date is in the format 1/24/2012 but when i load it into mysql it changes it to some decimal format e.g. 40932 ????

how can i just upload it as is, without it changing? o
What can i do i’m really stuck on this one!!!!

Any help would be most appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:20:12+00:00Added an answer on May 30, 2026 at 1:20 am

    Excel holds date values as the “real” number of days since a base date, which can be either 1st January 1900 (the default for Windows versions of Excel) or 1st January 1904 (the default for Mac versions of Excel): the time is the fractional part, so midday on any given date is 0.5 greater than midnight. To add to the misery, Feb29th 1900 is a valid date for the Windows 1900 calendar.

    Assuming the Windows 1900 calendar:

    function ExcelToPHP($dateValue = 0) {
        $myExcelBaseDate = 25569;
        //  Adjust for the spurious 29-Feb-1900 (Day 60)
        if ($dateValue < 60) {
            --$myExcelBaseDate;
        }
    
        // Perform conversion
        if ($dateValue >= 1) {
            $utcDays = $dateValue - $myExcelBaseDate;
            $returnValue = round($utcDays * 86400);
            if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
                $returnValue = (integer) $returnValue;
            }
        } else {
            $hours = round($dateValue * 24);
            $mins = round($dateValue * 1440) - round($hours * 60);
            $secs = round($dateValue * 86400) - round($hours * 3600) - round($mins * 60);
            $returnValue = (integer) gmmktime($hours, $mins, $secs);
        }
    
        // Return
        return $returnValue;
    }   //  function ExcelToPHP()
    

    if Mac 1904 base, replace

    $myExcelBaseDate = 25569;
        //  Adjust for the spurious 29-Feb-1900 (Day 60)
        if ($dateValue < 60) {
            --$myExcelBaseDate;
    }
    

    with

    $myExcelBaseDate = 24107;
    

    This will return a PHP date/time value (standard 1970 base date), that you can then format as you wish using date();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to upload an excel file and to store its contents in
I'm trying to upload an application to the iPhone App Store, but I get
I am creating a excel sheet that would autocomplete a text based on the
Iam trying to upload the video but when file uploads the following response displays
I am trying to upload multiple files but when i select more than 1
I'm trying to use SqlBulkCopy as per the example in Import Excel Spreadsheet Data
I'm trying to import XML data from an excel spreadsheet (saved as an 'XML
I´m trying to upload a file which is fetched from a server. But when
I'm trying to upload an excel file. I have an ASP.NET test site on
i'm trying upload image and mp3 in the same form but image is uploaded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.