osCmax v2.5 User Manual
Results 1 to 10 of 10

Dat of birth problem

This is a discussion on Dat of birth problem within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hi I'm VERY new to oscommerce and just have a small question I'm trying to change the date of birth ...

      
  1. #1
    New Member
    Join Date
    Sep 2004
    Posts
    6
    Rep Power
    0


    Default Dat of birth problem

    Hi
    I'm VERY new to oscommerce and just have a small question

    I'm trying to change the date of birth to english formated (when you create a new account).

    ie to read 24/01/1923 in stead of 01/24/1923


    Thanks
    EnergeeUK

  2. #2
    New Member
    Join Date
    Sep 2004
    Posts
    10
    Rep Power
    0


    Default

    php occurs in blocks surrounded by commenting. this commenting tells non programmers like you and me what each module of code is for. you would need to find the file that contains the date and just copy and paste them into the new order. ie change the order of the three modules. or they may be parts of one you wont know until you find the code.
    there is an article that will get you up to speed in the oscdox at chapter three of the mod guide, exercise 1.

  3. #3
    Member
    Join Date
    Aug 2003
    Location
    Southampton UK
    Posts
    63
    Rep Power
    0


    Default

    The date formats are defined in catalog\includes\languages\english.php

    Open english.pphp for editing and search for DOB_FORMAT_STRING, JS_DOB, ENTRY_DATE_OF_BIRTH_ERROR, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_FORMAT

    and change: setlocale(LC_TIME, 'en_US.ISO_8859-1');
    to: setlocale(LC_TIME, 'en_GB.ISO_8859-1');

  4. #4
    New Member
    Join Date
    Dec 2004
    Posts
    10
    Rep Power
    0


    Default

    I am trying to do this but having problems interpreting define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()

    Not sure what %A or %B is
    Trevor Locke
    Consultant
    www.b2bwebconsultants.co.uk

  5. #5
    Member
    Join Date
    Aug 2003
    Location
    Southampton UK
    Posts
    63
    Rep Power
    0

  6. #6
    New Member
    Join Date
    Dec 2004
    Posts
    10
    Rep Power
    0


    Default tried this but still getting format error

    Quote Originally Posted by NickW
    The date formats are defined in catalog\includes\languages\english.php

    Open english.pphp for editing and search for DOB_FORMAT_STRING, JS_DOB, ENTRY_DATE_OF_BIRTH_ERROR, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_FORMAT

    and change: setlocale(LC_TIME, 'en_US.ISO_8859-1');
    to: setlocale(LC_TIME, 'en_GB.ISO_8859-1');

    Yes I did all this but its still returning an error even when I enter 01/01/1978 into the Date of Birth box. Could not locate JS_DOB in the code for english.php - does that matter. Could anyone show an example of the modified code for UK format date of birth entry.
    Trevor Locke
    Consultant
    www.b2bwebconsultants.co.uk

  7. #7
    New Member
    Join Date
    Dec 2004
    Posts
    10
    Rep Power
    0


    Default reformatting date of birth

    I was hoping someone could deal with my posting about how to reform a date field from US to UK format. I have tried all the solutions that have already been posted, without success. So, where am I going wrong?
    Trevor Locke
    Consultant
    www.b2bwebconsultants.co.uk

  8. #8
    Lurker
    Join Date
    Sep 2004
    Posts
    2
    Rep Power
    0


    Default RE: reformatting date of birth

    Quote Originally Posted by b2bcons
    I was hoping someone could deal with my posting about how to reform a date field from US to UK format. I have tried all the solutions that have already been posted, without success. So, where am I going wrong?
    I have just done this today.
    Edit catalog/includes/languages/english.php
    Change the return statements as detailed below......

    // Return date in raw format
    // $date should be in format dd/mm/yyyy (changed from supplied default)
    // raw date is in format YYYYMMDD, or DDMMYYYY
    function tep_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);
    }
    }

    Because the other settings where changed from mm/dd/yyyy to dd/mm/yyyy, you needed to change the statements shown to extract the day and month from the different positions in $date.
    Seems to work ok for me. It gets me through the registration screen and it displays correctly when I look at my account details later.

    Regards
    Ian

  9. #9
    Lurker
    Join Date
    Aug 2005
    Posts
    2
    Rep Power
    0


    Default Change the date format for admin as well

    Hi all.
    I have successfully got the fix working. But the problem is with the admin page.
    When I try to change the date of birth of a customer it's still in the MM/DD/YY format.
    Also the "account created" date is in MM/DD/YY format.
    Does any one have any ideas on how to fix the admin date format.

    Cheers

  10. #10
    Lurker
    Join Date
    Aug 2005
    Posts
    2
    Rep Power
    0


    Default RE: Change the date format for admin as well

    I have fixed it.
    You need to change the same stuff as the before.
    Basically change to the following stuff
    setlocale(LC_TIME, 'en_GB.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()
    function tep_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);
    }
    }

    define('DOB_FORMAT_STRING', 'dd/mm/yyyy');

    define('ENTRY_DATE_OF_BIRTH_ERROR', ' <span class="errorText">(eg. 21/05/1970)</span>');

Similar Threads

  1. Email problem on webmail n aslo cupons problem
    By jikey in forum osCmax v2 Installation issues
    Replies: 0
    Last Post: 10-25-2006, 11:43 PM
  2. How to remove date of birth from registration???
    By stando in forum osCmax v1.7 Discussion
    Replies: 3
    Last Post: 07-29-2004, 08:10 PM
  3. How do i remove the Date of birth field in new account
    By forsythi in forum osCommerce 2.2 Modification Help
    Replies: 3
    Last Post: 12-16-2003, 12:59 AM

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
  •