Annulleret

Codeigniter Date Function

We need two Codeigniter functions. The first should be passed a text string, and be able to identify any dates contained within it, in any of the formats listed below. It should then be able to extract the date, pass it to the second function (see below), and then replace the date in the string, with the value returned from the other function.

The second when called, needs accepts two parameters the first is a date, in one of the following formats, the second is the output type - which has three possible options 'F' for full date (i.e. 1st April 2011), 'C' for compact date (i.e. 01-04-2011 dd-mm-yyyy), or 'M' for MySQL format date (2011-04-01 yyyy-mm-dd). The function should return a single value, of the date in the format requested.

The function needs to be able to recognise the correct day, month and year and undertake the appropriate conversion. In all the examples below the day is the first value, the month is the middle value, and the year is the last. All are 1st April 2011, although the function should be able to accept any calendar date, in any year.

Both should be optimised to be as efficient as possible, using the least amount of code.

An example of a text string containing a date that should be passed to the first function is:-

"Fred arrived at the hotel on 1 Apr 2011 and checked in as planned."

The first function should detect the date as '1 Apr 2011' and pass that to the second function with additional parameter of 'F' in this case, which should then return the value of 1st April 2011. The first function should then replace the date with the returned value, and return the full text string....

"Fred arrived at the hotel on 1st April 2011 and checked in as planned."

The text string may contain one or more dates, in one or more formats.

Possible different date formats:

[url removed, login to view]

[url removed, login to view]

[url removed, login to view]

[url removed, login to view]

[url removed, login to view]

[url removed, login to view]

[url removed, login to view]

01-04-11

01-4-11

1-04-11

01-04-2011

01-4-2011

1-4-2011

1-04-2011

01/04/11

01/4/11

1/04/11

01/04/2011

01/4/2011

1/4/2011

1/04/2011

1 Apr 2011

01 Apr 2011

1 Apr 11

01 Apr 11

01 April 2011

1 April 2011

01 April 11

1 April 11

01/April/2011

1/April/2011

01/April/11

1/April/11

01/Apr/11

01/Apr/2011

1/Apr/11

1/Apr/2011

1st April 11

1st Apr 11

01/04.11

01/4.11

1/04.11

01/04.2011

01/4.2011

1/4.2011

1/04.2011

01 04 11

01 4 11

1 04 11

01 04 2011

01 4 2011

1 4 2011

1 04 2011

There is an amendment to the project, with the following date formats added, in addition to those listed above.

1=4-11
1=4=11
1-4=11
01=4-11
01=4=11
01-4=11
01=04-11
01=04=11
01-04=11
1=4-2011
1=4=2011
1-4=2011
01=4-2011
01=4=2011
01-4=2011
01=04-2011
01=04=2011
01-04=2011
1,4,11
1,4.11
1.4,11
01,4,11
01,4.11
01.4,11
01,04,11
01,04.11
01.04,11
April 1, 2011
April 1st, 2011
April 1 2011
April 1st 2011
April 01 2011
April 01, 2011
Apr 1, 2011
Apr 1st, 2011
Apr 01, 2011
Apr 1 2011
Apr 01 2011
Apr 1st 2011
1/ April/2011
1/April /2011
1/April/ 2011

Færdigheder: Codeigniter, PHP

Se mere: codeigniter date function, date function codeigniter, codeigniter date functions, date functions codeigniter, codeigniter date, string date function codeigniter, using date function codeigniter, format full month codeigniter, month function codeigniter, date month year codeigniter, date function using codeigniter, codeigniter function date date, value options, m string, codeigniter function, function date codeigniter, codeigniter date string, day month year codeigniter, date string codeigniter, codeigniter date format, php codeigniter, function, fred, date, CodeIgniter php

Om arbejdsgiveren:
( 0 bedømmelser ) Scunthorpe, United Kingdom

Projekt-ID: #976834

5 freelancers are bidding on average $147 for this job

ALSOFT10

Sir, Please check your PMB. Regards, ALSOFT

$250 USD på 1 dag
(55 bedømmelser)
6.4
harish1984

Hi Richard, Codeigniter/PHP expert here. Please view PM. Thanks Harish.

$135 USD på 1 dag
(59 bedømmelser)
6.0
usedless

Hi mate, please check pmb.

$150 USD på 1 dag
(3 bedømmelser)
2.6
mdpauley

I can do this no problem! Please see your PMB!

$50 USD in 2 dage
(5 bedømmelser)
2.5
oOoDeXoNoOo

I'm so excited!

$150 USD in 3 dage
(0 bedømmelser)
0.0