Thread: Date Formatting

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jun 2007
    Location
    North West
    Posts
    9
    Plugin Contributions
    0

    Default Date Formatting

    Hi

    My customer has got specials on his products and wants to use the calendar to setup the dates in the admin panel. The problem is, the calendar formats it using UK date and time, and the form requires American format.

    The customer refuses to type them in manually and is chasing for the changes to be done so he can use the calendar.

    Any indication would be great on how to change this

    Regards
    Stephen

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Date Formatting

    Umm ... s/he cannot click the little calendar and visually select the date so it doesn't go against his/her umm ... well ... needs ...

    What part is just killing him/her?

    The Catalog can display anyway you want ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jun 2007
    Location
    North West
    Posts
    9
    Plugin Contributions
    0

    Default Re: Date Formatting

    Sorry if I confused you, was an exhausting day at work last night.

    My client has requested that we use the english date formats, and one of my co-workers working on the project has edited the language files so this can be achieved.

    The problem we found is when the user wants to add a special promotion to one of his products, he opens up the zen cart calendar and clicks on the day he would like. This then places the appropriate text in the input field.

    The text inserted in the input field is inserted using the ENGLISH date format (dd/mm/yyyy) but the form requires american format (mm/dd/yyyy) - I think this may be something to do with the SQL Table Field being set as a date ?

  4. #4
    Join Date
    Dec 2005
    Posts
    460
    Plugin Contributions
    0

    Default Re: Date Formatting

    If you change the date format for the UK, specials and sale maker date format will not work e.g Start date 22/11/2007 results as 30/11/2036 and End date 23/11/2007 results as 30/11/2036 also, its a question I asked several months ago but never got anywhere.
    Like you suggest I would think that the date format is not getting converted to the American format before inserting into the database, thus when inserted into the database it is not getting the correct values for mm/dd/yyyy format.
    The way around I use is just leave the date clear and you get Start - Immediately End - Never.
    Would be good to sort this tho, for a future release.

  5. #5
    Join Date
    Dec 2005
    Posts
    460
    Plugin Contributions
    0

    Default Re: Date Formatting

    Do this below and it works a treat.

    UK Date Format

    Thanks gilby, I eventually got it working.

    For anyone else who wants to know here is what I done step by step to change the date format from mm/dd/yyyy to dd/mm/yyyy:

    1. open file includes/languages/<YOUR_TEMPLATE>/<YOUR_LANGUAGE>.php

    2. find this section around line 22:
    Quote:
    @setlocale(LC_TIME, 'en_US.ISO_8859-1');
    define('DATE_FORMAT_SHORT', '%m/%d/%Y'); // this is used for strftime()
    define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
    define('DATE_FORMAT', 'm/d/Y'); // this is used for date()
    define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    and replace with:
    Quote:
    @setlocale(LC_TIME, 'en_US.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('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    3. in the same file find this section around line 29:
    Quote:
    // Return date in raw format
    // $date should be in format mm/dd/yyyy
    // 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);
    }
    }
    }
    and replace with:
    Quote:
    // Return date in raw format
    // $date should be in format mm/dd/yyyy
    // 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);
    }
    }
    }
    4. In the same file find this section around line 67:
    Quote:
    // text for date of birth example
    define('DOB_FORMAT_STRING', 'mm/dd/yyyy');
    and replace with:
    Quote:
    // text for date of birth example
    define('DOB_FORMAT_STRING', 'dd/mm/yyyy');
    5. In the same file find this section around line 200:
    Quote:
    define('ENTRY_DATE_OF_BIRTH_ERROR', 'Is your birth date correct? Our system requires the date in this format: MM/DD/YYYY (eg 05/21/1970)');
    define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 05/21/1970)');
    and replace with:
    Quote:
    define('ENTRY_DATE_OF_BIRTH_ERROR', 'Is your birth date correct? Our system requires the date in this format: DD/MM/YYYY (eg 21/05/1970)');
    define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 21/05/1970)');
    6. Open file admin/includes/languages/<YOUR_LANGUAGE>.php

    7. Find this section around line 20:
    Quote:
    setlocale(LC_TIME, 'en_US.ISO_8859-1');
    define('DATE_FORMAT_SHORT', '%m/%d/%Y'); // this is used for strftime()
    define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
    define('DATE_FORMAT', 'm/d/Y'); // this is used for date()
    define('PHP_DATE_TIME_FORMAT', 'm/d/Y H:i:s'); // this is used for date()
    define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    define('DATE_FORMAT_SPIFFYCAL', 'MM/dd/yyyy'); //Use only 'dd', 'MM' and 'yyyy' here in any order
    and replace with:
    Quote:
    setlocale(LC_TIME, 'en_US.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
    8. In the same file find this section around line 29:
    Quote:
    // Return date in raw format
    // $date should be in format mm/dd/yyyy
    // raw date is in format YYYYMMDD, or DDMMYYYY
    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);
    }
    }
    and replace with:
    Quote:
    // Return date in raw format
    // $date should be in format mm/dd/yyyy
    // raw date is in format YYYYMMDD, or DDMMYYYY
    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);
    }
    }
    9. In the same file find this section around line 85:
    Quote:
    // text for date of birth example
    define('DOB_FORMAT_STRING', 'mm/dd/yyyy');
    and replace with:
    Quote:
    // text for date of birth example
    define('DOB_FORMAT_STRING', 'dd/mm/yyyy');
    10. In the same file find this section around line 204:
    Quote:
    define('JS_DOB', '* The \'Date of Birth\' entry must be in the format: xx/xx/xxxx (month/date/year).\n');
    and replace with:
    Quote:
    define('JS_DOB', '* The \'Date of Birth\' entry must be in the format: xx/xx/xxxx (date/month/year).\n');
    11. In the same file find this section around line 231:
    Quote:
    define('ENTRY_DATE_OF_BIRTH_ERROR', '&nbsp;<span class="errorText">(eg. 05/21/1970)</span>');
    and replace with:
    Quote:
    define('ENTRY_DATE_OF_BIRTH_ERROR', '&nbsp;<span class="errorText">(eg. 21/05/1970)</span>');
    12. Pat yourself on the back, you're all done.

  6. #6
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: Date Formatting

    This solved the problem - Great Stuff!! It works like a sewing machine - humming away.

    Thanks a million and a half!

    Frank

    Frank Riegel Natural Therapies

  7. #7
    Join Date
    Nov 2006
    Posts
    69
    Plugin Contributions
    0

    Default Re: Date Formatting

    Hi All i just followed this to the letter twice on a 1.3.8 install
    All appeared good till i tried to add to cart the the page just hangs blank.
    Anyone got any ideas?

  8. #8
    Join Date
    Dec 2005
    Posts
    460
    Plugin Contributions
    0

    Default Re: Date Formatting

    Is this on a test server or live site, I was having a similar issue and it turned out to be a hosting issue.
    Easy way fault find reset the date to the original settings and see if you still have this issue.

  9. #9
    Join Date
    Jan 2008
    Location
    Sydney, Australia
    Posts
    21
    Plugin Contributions
    0

    Default Re: Date Formatting

    Quote:
    Some shopping cart "solutions" seem to be complicated programming exercises instead of responding to users' needs, Zen Cart™ puts the merchants and shoppers requirements first. Similarly, other shopping cart software programs are nearly impossible to install and use without an IT degree, Zen Cart™ can be installed and set-up by anyone with the most basic web site building and computer skills.

    ???

  10. #10
    Join Date
    Dec 2005
    Posts
    460
    Plugin Contributions
    0

    Default Re: Date Formatting

    [QUOTE]Some shopping cart "solutions" seem to be complicated programming exercises instead of responding to users' needs, Zen Cart™ puts the merchants and shoppers requirements first. Similarly, other shopping cart software programs are nearly impossible to install and use without an IT degree, Zen Cart™ can be installed and set-up by anyone with the most basic web site building and computer skills.[\QUOTE]

    Whats your problem with this statement, I would totally agree with it, YES Zencart is not a .exe or a .deb that you install by one click, but it can be done "by anyone with the most basic web site building and computer skills"

    If Zen-Cart is too above you go and buy a .exe on-line solution there are plenty out there, but I would say not as good as Zen-Cart.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. order delivery date addon - date not showing in checkout
    By jagall in forum Addon Shipping Modules
    Replies: 4
    Last Post: 19 Oct 2017, 09:09 PM
  2. Sales or Specials with Time and Date (instead of date only) Expiration
    By townsend2009 in forum Setting Up Specials and SaleMaker
    Replies: 3
    Last Post: 29 Jan 2015, 07:56 PM
  3. Replies: 5
    Last Post: 17 Mar 2010, 06:36 PM
  4. Easy Populate and the Date added updated to todays date issue.
    By cyphercys in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 9 Mar 2010, 04:26 AM

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