/    Sign up×
Community /Pin to ProfileBookmark

Download File – issues with Birth Dates

I am attempting to create a CSV or XLS file with information. Below is my header on the script.

header(“Content-type: application/x-ms-download”);
header(“Content-Disposition: attachment; filename=newdowload.csv”);

Issue is, If I have a birth date (mmddyy) the zero is supressed in the month. I need this leading zero. (i.e. 04012001 comes in the XLS file as 4012001).

Any help here would be appreciated.

Thx,

DPK

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@balloonbuffoonMay 27.2006 — Where are you getting this value from? Can you post more code? You really haven't given a whole lot of information.

--Steve
Copy linkTweet thisAlerts:
@dpkyteauthorMay 27.2006 — The echo statement is as shown below:

echo substr($dob,5, 2).substr($dob,8, 2).substr($dob,2, 2)."t".$email."n";
Copy linkTweet thisAlerts:
@balloonbuffoonMay 28.2006 — What is the format of $dob? How is it set?

If the whole code isn't [I]that[/I] long, you might as well post it all. (That would be helpful.)

--Steve
Copy linkTweet thisAlerts:
@dpkyteauthorMay 28.2006 — The other code really does not matter too much. The issue here is the date of birth is in CCYY-MM-DD format, If the dob is 2001-04-03, when the value gets posted and opened up in the excell SS it truncates the initial 0 so the value in the SS would be 40101, not 040301.
Copy linkTweet thisAlerts:
@balloonbuffoonMay 29.2006 — So then is this a PHP problem, or a problem to do with the external program you're opening the file with? What is "excell SS"?

--Steve
×

Success!

Help @dpkyte spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...