Simple PHP Script

  • Status Closed
  • Budget $30 - $250 USD
  • Total Bids 20

Project Description

I need a PHP script to return a date range for me that will be used for a digital coupon.

It needs to handle both English and Spanish.

$startdate=""; //This assumes $startdate="20130201" or $startdate="" when today is March 1, 2013

$numberofdays=7;

$language="E";

$result=GiveDateRange($startdate,$numberofdays,$language);

$result returns:

"Valid: Fri. Mar 1, 2013 - Fri. Mar 8, 2013"

This script is not a big deal. I have given great specs below and examples to make it clear.

$startdate=""; //Blank=today, otherwise format "yyyymmdd"

$numberofdays=7;

so endate is $startdate + $numberordays

$language = "E" "S" "BE" "BS";

Which language

"E"=English,

"S"=Spanish,

"BE"=both English Spanish,

"BS"=Both. Spanish English

Here are your translations needed:

Day Translation

Sunday/Domingo

Monday/Lunes

Tuesday/Martes

Wednesday/Miércoles

Thursday/Jueves

Friday/Viernes

Saturday/Sábado

English Day Abbrevations. (Starting with Sunday)

Sun.

Mon.

Tue.

Wed.

Thu.

Fri.

Sat.

English Month Abbrevations.

Jan

Feb

Mar

Apr

May

Jun

Jul

Aug

Sep

Oct

Nov

Dec

Spanish Day Abbrevations. (Starting with Sunday)

Dom.

Lun.

Mar.

Mié.

Jue.

Vie.

Sáb.

Spanish Month Abbreviations

Enero

Feb.

Marzo

Abr.

Mayo

Jun.

Jul.

Agosto

Sept.

Oct.

Nov.

Dic.

-----------------------------------------

Example of output.

-----------------------------------------

Example 1: (Today is March 1, 2013)

$startdate=""; //This assumes today is March 1, 2013

$numberofdays=7;

$language="E";

$result=GiveDateRange($startdate,$numberofdays,$language);

$result returns:

"Valid: Fri. Mar 1, 2013 - Fri. Mar 8, 2013"

Example 2:

$startdate="20130315"; // We pass the date of March 15, 2013

$numberofdays=2;

$language="S";

$result=GiveDateRange($startdate,$numberofdays,$language);

$result returns:

"Válido: Vie. Marzo 15, 2013 - Dom. Marzo 17, 2013"

Example 3:

$startdate=""; //This assumes $startdate="20130301" or $startdate="" when today is March 1, 2013

$numberofdays=7;

$language="BE";

****When $language="BE", it will return first the English + + Spanish.

$result=GiveDateRange($startdate,$numberofdays,$language);

$result returns:

"Valid: Fri. Mar 1, 2013 - Fri. Mar 8, 2013Válido: Vie. Marzo 1, 2013 - Vie. Marzo 8, 2013"

Example 4:

$startdate="20130301"; //We pass the date

$numberofdays=7;

$language="BS";

****When $language="BS", it will return first the Spanish + + English .

$result=GiveDateRange($startdate,$numberofdays,$language);

$result returns:

"Válido: Vie. Marzo 1, 2013 - Vie. Marzo 8, 2013 Valid: Fri. Mar 1, 2013 - Fri. Mar 8, 2013"

You will need to supply a working FULLY TESTED script, and a PHP script that will call the working script with 10 different and varied examples.

It is NOT MY JOB to test your script. It's not that complex, so please be sure to test it in different scenarios, including using examples that

span across 2 months.

Thanks,

Barney

Get free quotes for a project like this
Awarded to:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online