Zen Cart Logo
Forums / General Questions / Can anyone explain how the date format works?

Can anyone explain how the date format works?

Locked

Views: 875

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
24 Mar 2009, 11:38 PM
#1
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Can anyone explain how the date format works?

I want our date format to be dd/mm/yyyy

I am using an "addon" which allow me to upload customers I already have, but the add-on was written for USA ie mm/dd/yyyy. I have already made changes to the ../english.php file to allow my format to be dd/mm/yyyy on my site.

But when I use the add-on it doesn't work because of the code below:

if (ACCOUNT_DOB == 'true') {
		if (ENTRY_DOB_MIN_LENGTH >0 && strlen($customers_dob) > 0) {

			$customers_dob = str_replace('-','',$customers_dob);
			$customers_dob = str_replace('/','',$customers_dob);

			$month = (int)substr($customers_dob, 4, 2);
			$day = (int)substr($customers_dob, 6, 2);
			$year = (int)substr($customers_dob, 0, 4);

			if (!checkdate($month, $day, $year)) {
				$errors[] = 'DOB is invalid (Must be YYYYMMDD, YYYY/MM/DD or YYYY-MM-DD)';
			}
		} else {
			$customers_dob = '0001-01-01 00:00:00';
		}
	}

How can I modify this to allow the format to be dd/mm/yyy? I'm sure it has something to do with the "6" and "4" after $custromers_dob

Thanks heaps in advance for any assistance or any ideas at all, I have spend days trying different method, just can't seen to figure it out?

24 Mar 2009, 11:49 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Can anyone explain how the date format works?

You are mistaken about what that code does. It actually takes a date, not in US mm/dd/yyyy format, but in international format (as per the error message) and serves it to the php checkdate() function in US order only because that's what the checkdate function requires.

25 Mar 2009, 10:15 AM
#3
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Re: Can anyone explain how the date format works?

Thanks Kuroi, :blush: still getting the hang of this...

Quick question...

I can update the customers >> edit page with no problem.
But when I want to add a member the date is messed up.

Some examples:

Putin 01010101 get 01/10/2001
Putin 02010301 get 02/10/2001
Putin 10050607 get 30/11/2036
Putin 19720102 get 30/11/2036

Any ideas? Thanks again for your help.