/    Sign up×
Community /Pin to ProfileBookmark

I want to default an expiration date to a infinity if one isn’t provided. What’s the easiest way? Is it to just pick a date in 2038?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscJan 05.2012 — If you think your app/service/website will be around in 26 years then no.

Why 2038? Why not 2199?

Dates beyond 2038 are handled perfectly fine in PHP if done properly - I tend to use DateTime objects now for everything, they react better to >2038 dates than the date() function.
Copy linkTweet thisAlerts:
@martingalehauthorJan 05.2012 — I usually use timestamps and I figure a 32 bit number and its usual limitations. I don't use php enough to know if time()<inf will work or not
Copy linkTweet thisAlerts:
@OctoberWindJan 06.2012 — Why not use Dec 22, 2012?

I mean, the day after the rapture, there won't be much use for anything! ?

What's the purpose of setting a default expiration of "infinity"? If you're using it to limit the publishing of a "generic item", then why not just check if a date is set first, before attempting to display/term it?
×

Success!

Help @martingaleh 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.16,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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