Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2007
    Location
    Jakarta
    Posts
    358
    Plugin Contributions
    0

    Default Changing the DOB date format customers to use DDMMYYYY

    I'm setting up a language other than English on my site, in this case Indonesian. I need the date format to use DDMMYYY.

    I've attempted to accomplish this by changing the defines in languages/MY_TEMPLATE/indonesian.php

    Code:
      define('DATE_FORMAT_SHORT', '%d/%m/%Y');  // this is used for strftime()
      define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
      define('DATE_FORMAT', 'd/m/Y'); // this is used for date()
    
    // raw date is in format YYYYMMDD, or DDMMYYYY
      if (!function_exists('zen_date_raw')) {
        function zen_date_raw($date, $reverse = false) {
          if ($reverse) {
            return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
          } else {
            return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
          }
        }
      }
    
    // text for date of birth example
      define('DOB_FORMAT_STRING', 'dd/mm/yyyy');
    The date entered as 07/02/1972 is saved as Jun 2 1972. But when redisplayed it appears in the format of DDMMYYYY (02/07/1972).

    So with out changing any information and just updating the customer record repeatedly, the DOB will alternatively save as 07/02/1972 and 02/07/1972.

    What needs to be changed to update and display the DOB in the format DDMMYYYY?

  2. #2
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Changing the DOB date format customers to use DDMMYYYY

    There is also a language file in ADMIN, where you need to make the changes.

  3. #3
    Join Date
    Jul 2007
    Location
    Jakarta
    Posts
    358
    Plugin Contributions
    0

    Default Re: Changing the DOB date format customers to use DDMMYYYY

    I've checked admin/includes/languages/indonesian.php
    It looks as if the file is already set to accept the DD/MM/YYYY format for Indonesian.

    Code:
    setlocale(LC_TIME, 'id_ID.ISO_8859-1');
    define('DATE_FORMAT_SHORT', '%d/%m/%Y');  // this is used for strftime()
    define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
    define('DATE_FORMAT', 'd/m/Y'); // this is used for date()
    define('PHP_DATE_TIME_FORMAT', 'd/m/Y H:i:s'); // this is used for date()
    define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    define('DATE_FORMAT_SPIFFYCAL', 'dd/MM/yyyy');  //Use only 'dd', 'MM' and 'yyyy' here in any order
    
    define('DOB_FORMAT_STRING', 'dd/mm/yyyy');
    This doesn't do the trick. Anyone know how to accomplish this?

  4. #4
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Changing the DOB date format customers to use DDMMYYYY

    Your code currently says:

    Code:
    // raw date is in format YYYYMMDD, or DDMMYYYY
      if (!function_exists('zen_date_raw')) {
        function zen_date_raw($date, $reverse = false) {
          if ($reverse) {
            return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
          } else {
            return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
          }
        }
      }
    It shoud be:

    Code:
    // raw date is in format YYYYMMDD, or DDMMYYYY
      if (!function_exists('zen_date_raw')) {
    function zen_date_raw($date, $reverse = false) {
    if ($reverse) {
              return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);
    } else {
      return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);
          }
        }
      }

  5. #5
    Join Date
    Jul 2007
    Location
    Jakarta
    Posts
    358
    Plugin Contributions
    0

    Default Re: Changing the DOB date format customers to use DDMMYYYY

    Thanks fairestcape. That worked like a charm.

 

 

Similar Threads

  1. DOB & Date format warning message in user registration
    By pabloirl in forum General Questions
    Replies: 1
    Last Post: 10 Jan 2012, 05:33 PM
  2. Changing the date format from US to UK i.e mmddyyyy to ddmmyyyy
    By alwayslearning in forum Basic Configuration
    Replies: 9
    Last Post: 4 Nov 2011, 12:56 AM
  3. changing dob format when registering customers
    By evil turinp in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 1 Apr 2010, 01:46 AM
  4. Changing Date to UK format
    By startrek in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 29 May 2007, 08:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR