CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • incorrect century for imported dates after 2010
Pages: [1]

Author Topic: incorrect century for imported dates after 2010  (Read 1284 times)

Tim Homewood

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
incorrect century for imported dates after 2010
February 02, 2010, 04:22:19 am
Hi,

I'm importing members into CiviCRM v3.1 installed in Joomla 1.5.15. The CSV file contains dates in the format dd/mm/yy. I am able to import these records however once imported any date for 2010 and later shows as 1910.

I tested on the demo site and the same result happened for my imports.

I checked the database and the dates are in the database incorrectly which means the problem must be with the importation process (ie it's not a display issue).

Here is some sample data I used to import into the demo site:
"Membership Number","Membership Type","Date Joined","Expiry date"
"V3609","General",13/02/95,13/01/11
"V5289","General",13/01/10,13/01/11
"V4529","General",30/01/02,31/12/10
"V4531","General",31/01/02,31/12/10

Is this the Y2k10+ bug?

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: incorrect century for imported dates after 2010
February 02, 2010, 05:50:41 am
current rules say's :-
 1.  01 - 09 is always 2000 - 2009
 2.  10 - 99 is always 1910 - 1999

you might want to take a look for code, go to CRM/Utils/Date.php line no 596 onward.

Code: [Select]
        $year = (int ) $year;
        // simple heuristic to determine what century to use
        // 01 - 09 is always 2000 - 2009
        // 10 - 99 is always 1910 - 1999
        if ( $year < 10 ) {
            $year = $cen . '0' . $year;
        } else if ( $year < 100 ) {
            $year = $prevCen . $year;
        }

It is not only for membership import, these are applicable across entire civicrm. 

hope this help

kiran
You Are Designed To Choose... Defined By Choice.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: incorrect century for imported dates after 2010
February 02, 2010, 06:28:01 am

i think we should change the rule to be: 01-20 => 20XX, 21-99 => 19XX

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: incorrect century for imported dates after 2010
February 02, 2010, 07:12:22 am
filed issue is here : http://issues.civicrm.org/jira/browse/CRM-5753

kiran
You Are Designed To Choose... Defined By Choice.

Tim Homewood

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
Re: incorrect century for imported dates after 2010
February 02, 2010, 03:25:35 pm
Thanks Kiran, solution clearly identified and worked.

I had to make a slight adjustment to allow for the zero. Please excuse any syntax errors as I'm a hacker not a coder:
Code: [Select]
        if ( $year < 10 ) {
            $year = $cen . '0' . $year;
        } else if ( $year < 30 ) {
            $year = $cen . $year;
        } else if ( $year < 100 ) {
            $year = $prevCen . $year;
        }

And thank you for the very swift response and issue filing.

I greatly appreciate how easy it is to use CiviCRM. I'm using it in both Joomla for an arts organisation and Drupal for a political organisation and both groups love it. Once I have finished setting up theses sites I hope to be able to contribute in some way though the documentation is so good already I'm not sure how I can help. But I'm sure there's a way.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: incorrect century for imported dates after 2010
February 03, 2010, 11:55:59 am
Some ways to help include:
- helping other new folks on this forum

- adding case study / success stories to the Showcase section of the forum - describing your orgs and how they're using CiviCRM to further their work / mission etc.
http://forum.civicrm.org/index.php/board,4.0.html

- attending (or starting) a CiviCRM meetup in your area

- testing alpha / beta new releases on a test server with your org's data / configurations and reporting bugs, upgrade problems etc.

:-)
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • incorrect century for imported dates after 2010

This forum was archived on 2017-11-26.