/    Sign up×
Community /Pin to ProfileBookmark

Formatting for display a date pulled from a database

I have dates stored in an MS-Access a database as data/time values.

I have found lots of material on how to format the current date for presentation, but I want to have the date from the database ($startdate) to show as “Jun-01” in one place and “June 1st, 2005” in another place.

Can anyone help me? Surely this isn’t unusual – the page I’m inutting this message on uses a formatted date from a database!

Thanks in advance,

Rob

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsJun 05.2005 — store dates as integers (the values returned from mktime(), strtotime(), etc.)

then use the date() function to format them as you want
Copy linkTweet thisAlerts:
@scaiferwauthorJun 05.2005 — Thank you, I just came back to say I found it.

The line below gives me just what I need to work with.

[CODE]$ldate_start = date("D, j-M-Y", strtotime("$startdate"));[/CODE]

I just found this forum, what a great resource.

Cheers,

Rob
×

Success!

Help @scaiferw 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.4,
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,
)...