/    Sign up×
Community /Pin to ProfileBookmark

yyyymmdd to "2004 october 13"

i’ve read php.net’s Date and mktime and several other unctions but still can’t guess it right.
Retrieving from a database I get an integer in the format yyyymmdd something like [B]20051102[/B] for [B][U]November 2nd, 2005[/U][/B]. and I want to display it as the second format. sounds simple but i havent found a way, maybe im too tired by now or im just stupid but some light on this would be a bless
thanks either way

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@purefanauthorNov 03.2005 — im so sorry...I found this:

http://www.webdeveloper.com/forum/showthread.php?t=36090&highlight=yyyymmdd

I had looked for date and the names of the functions and forgot to look for "yyyymmdd"

sorry guys
Copy linkTweet thisAlerts:
@tbirnsethNov 03.2005 — I use the following routines for converting to/from "friendly" date/times. If you find them useful, have at it.
[code=php]
function toFdate($mtime, $useDay=TRUE) {
if( $useDay )
return( $mtime ? date("D n/j/y", strtotime($mtime)) : $mtime );
else
return( $mtime ? date("n/j/y", strtotime($mtime)) : $mtime );
}
function fromFdate($ftime) {
return( $ftime ? date("Y-m-d", strtotime($ftime)) : $ftime );
}
function toFtime($mtime) { // From 18:06:33 to 6:06 PM
// Special case
if( $mtime == '00:00:00' )
return('');
return( $mtime ? date("g:i A", strtotime($mtime)) : $mtime );
}
function fromFtime($ftime) {
return( $ftime ? date("H:i:s", strtotime($ftime)): $ftime );
}
function toFdateTime($mtime) { // From: 2005-08-26 18:06:45 to Fri 8/26/05 6:06 PM
return($mtime ? date("D n/j/y g:i A", strtotime($mtime)) : $mtime );
}
function fromFdateTime($ftime) { // From: Fri 8/26/05 6:06 PM to 2005-08-26 18:06:00
return($ftime ? date("Y-m-d H:i:s", strtotime($ftime)) : $ftime);
}
[/code]
Copy linkTweet thisAlerts:
@bokehNov 03.2005 — I think the easiest thing ¡s to store a UNIX TIMESTAMP rather than anything else. Both MySQL or PHP can do this and once retrieved it is easy to convert into any format you fancy.
×

Success!

Help @purefan 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.3,
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,
)...