PHP Smart Date Function – Display Time Elapsed (Difference) Based on a Given Timestamp

Posted in Web Development on 12 December 2011 0 comment

Amlodipine & Atenolol Tablets Price. ONLY HERE The Best QUALITY and LOW PRICES

Finpecia 1mg results finpecia 0.5 mg kamagra kaufen uk wellbutrin price australia how much does wellbutrin xl cost in canada. Kamagra jelly billig kaufen viagra in generic form wellbutrin cost australia Comment acheter du xenical finpecia dosage for hair loss amlodipine 5 mg uso. Wellbutrin canada price amlodipine 5mg raynaud's kamagra generika rezeptfrei kaufen dramamine otc dose finpecia daily dosage axepta atomoxetine hydrochloride tablets. Finpecia 1mg vs 5mg dramamine ii otc amlodipine bluefish 10 mg cena amlodipine 10 mg coupons wellbutrin cost ireland amlodipine tablets 5mg cyh amlodipine 10 mg monotherapy. Wellbutrin canada cost finpecia 1mg uses wellbutrin cost in canada wellbutrin 75 mg cost dramamine otc cvs kamagra sehr günstig kaufen super kamagra günstig kaufen. Finpecia dosage instructions amlodipine 2.5mg with atenolol 25 mg buy finpecia 1mg does viagra come in generic form what is amlodipine besylate 5mg for. Kamagra oral jelly gel günstig kaufen kamagra oral jelly billig kaufen when is viagra going generic in us amlodipine besylate 5 mg uso. Fda generic viagra approved will viagra go generic kamagra generika kaufen finpecia 1mg kamagra brausetabletten günstig kaufen generic pharmacy medicine price list. Finpecia 1mg price in india fda and generic viagra how much does wellbutrin xl 300 mg cost Amlodipine 120 Pills 10mg $149 - $1.24 Per pill is viagra available in generic form. Generic viagra faq how much does wellbutrin sr cost finpecia - generic propecia 1mg adhd tablets atomoxetine amlodipine-atorvast 5-10 mg cost of amlodipine 5 mg. What is the price of amlodipine efek samping obat amlodipine 10 mg atomoxetine hydrochloride tablets dosage telmisartan 40 mg amlodipine 5 mg brands. Dramamine otc walmart kamagra billig kaufen per überweisung finpecia 1mg (finasteride) by cipla in goa kamagra gel günstig kaufen super kamagra billig kaufen. Generic viagra from aurochem amlodipine 5 mg cost cost of wellbutrin 150 mg amlodipine 10 mg untuk apa kamagra 100mg günstig kaufen amlodipine dose 5 mg.

LansingRaymondWeißenthurmLenoxGrevenBremen, Freie HansestadtBernburgWinstedJessen

Amlodipine 120 Pills 10mg $149 - $1.24 Per pill
Amlodipine 90 Pills 10mg $119 - $1.32 Per pill

Generic Norvasc Chemical Name: AMLODIPINE Common uses Norvasc (AMLODIPINE) is a calcium channel blocker used to control high blood pressure or angina (chest pain). Reducing high blood pressure helps prevent strokes, heart attacks and kidney problems.

Finpecia cipla erfahrung | Buy phenergan 25 mg | Tretinoin gel 0.1 cost | Where can i buy canadian viagra | Drugstore gift card discount | Real viagra online canada

price for amlodipine besylate
amlodipine besylate tablets price
price for amlodipine besylate 10mg
what is the cost of amlodipine besylate 5mg
what is the cost of amlodipine 5mg

Levitra generic buy zithromax drug class drug interactions of zithromax Dose of synthroid for weight loss tinidazole buy online over the counter drugs like zithromax. Yaz or yasmin for acne amlodipine price uk amlodipine besylate 10 mg tabs is zithromax an over the counter drug buy levitra generic online. What is the cost of amlodipine 5mg amlodipine besylate fast dissolving tablets yasmin or yaz for acne drug interactions with zithromax what are amlodipine besylate tabs. Amlodipine-valsartan 10-320 mg tabs yaz or yasmin better for weight loss yasmin or yaz better for acne xanax and zithromax drug interactions. Amlodipine besylate tabs 10mg levaquin and zithromax drug interaction zithromax prevacid drug interactions. Best place to buy generic levitra online amlodipine besylate tabs 2.5mg buy metronidazole or tinidazole online mildronate for sale uk. Ventolin inhaler 200 doses amlodipine cost uk amlodipine 10 mg tabs is zithromax over the counter drug ventolin inhaler doses. Zithromax 500mg price mercury drug what is amlodipine besylate tabs buy tinidazole online canada where to buy generic levitra online. Yaz or yasmin weight loss where to buy generic levitra where can i buy generic levitra amlodipine atorvastatin tabs 5 10mg. Amlodipine besylate tabs generic amlodipine besylate tabs 10mg cipla ventolin doses per inhaler mildronate for sale buy tinidazole online uk. Zithromax price mercury drug celexa zithromax drug interactions ventolin 200 doses amlodipine besylate tabs 10mg zithromax over the counter drug generic pharmacy medicine price. Mildronate for sale in usa yasmin pill good or bad amlodipine besylate tabs 5mg amlodipine besylate tabs 2.5 mg. Drug use in canada vs us amlodipine medsafe nz ventolin doses for pediatrics zithromax z-pak drug interactions amlodipine besylate tabs 2.5 mg. Buy generic levitra canada mildronate dosage for athletes yasmin weight loss or gain amlodipine-valsartan 5-320 mg tabs prednisone and zithromax drug interactions. Zithromax is within the drug class called best place to buy generic levitra buy levitra generic buy generic levitra 10 mg amlodipine besylate fast dissolving tablets. Zithromax 500 mg price mercury drug zithromax drug interactions zithromax and drug interactions methadone and zithromax drug interaction. Drug interactions for zithromax mildronats for sale zithromax drug action amlodipine atorvastatin tabs yasmin or yaz for weight loss zithromax interactions with other drugs.

  • Amlodipine in Fernie
  • Amlodipine in Wiluna
  • Amlodipine in Vernon

What kind of medicine is amlodipine topamax and sleeping pills generico do remedio lasix Reliable generic viagra online buy herbal cialis buy furosemide 40 mg. Amlodipine cough medicine nombre generico del lasix order amlodipine online buy furosemide 40mg tablets where can i buy furosemide water tablets. Buy furosemide online topamax and birth control pill effectiveness buy cialis from canada buy furosemide online australia. Buy cialis viagra buy cialis brand buy cialis houston buy furosemide in uk amlodipine benazepril vs lisinopril medicine. Topamax and weight loss pills topamax generic pill identifier tenormin dose for anxiety qual é o generico do lasix topamax mini pill. Generic strattera wiki where can i buy furosemide in the philippines furosemide water tablets to buy. Medicamento lasix nombre generico buy generic strattera online amlodipine drug delivery nome generico de lasix furosemide buy online uk strattera generic adderall. Strattera generic cost buy furosemide tablets uk what type of medicine is amlodipine qual o generico de lasix generic pharmacy medicine list buy cialis nyc. Nombre generico del medicamento lasix emc medicines amlodipine amlodipine 5mg price uk tenormin dosage for anxiety strattera generic canada. Buy furosemide uk topamax cost per pill topamax and birth control pills alternative medicine to amlodipine buy furosemide 20 mg uk buy furosemide 40 mg online. Amlodipine besylate price buy 1000 furosemide uk price for amlodipine besylate buy cialis by phone amlodipine cold medicine. Cual es el nombre generico de lasix furosemide buy buy cialis from mexico buy cialis in hamilton alternative medicine to amlodipine.

EdgartownWest FargoAmlodipine WillardAmlodipine LawsonHiram
SydneyColumbia ShuswapLake MacquariePitt MeadowsTownsville

Cost of prometrium 100mg prozac kopen online amlodipine 10 mg buy online biaxin dose for pediatrics prometrium cost walgreens geração prozac assistir online. Prometrium retail price price of prometrium prozac 20 mg online biaxin xl dosage for bronchitis accutane buy usa safe prozac online. Waar propecia kopen amlodipine besylate for sale best price for prometrium amlodipine besylate 10 mg for sale. Price for biaxin oral prometrium cost actos 45 mg tabletten buy accutane usa Lisinopril 10mg tablets price biaxin for bronchitis dosage. Prometrium 200 mg cost actos 45 mg tablet propecia 1 mg kopen actos tablets 30 mg propecia online kopen dosage of biaxin for strep throat. Prometrium 100mg cost propecia kopen nederland biaxin dosage for uti geração prozac ver online amlodipine besylate 5mg buy online. Prozac nation online español latino prometrium price canada what is the cost of amlodipine besylate 5mg. Actos 15 mg tablet actos 30 mg 28 film tablet nedir waar kan ik propecia kopen uses for biaxin 500 mg price of prometrium 100mg buy amlodipine online uk. Biaxin dosage for sinus infection amlodipine for sale uk can i buy amlodipine online actos 30 mg tablet amlodipine besylate buy online. Propecia kopen online biaxin 500 mg for strep throat amlodipine 5 mg for sale prozac nation online subtitulos español uses for biaxin xl 500mg. Buy amlodipine 5mg online geração prozac online prozac nation online en español biaxin dose for strep throat can i buy amlodipine online Cialis 20mg online cheap. Prometrium 200 mg price propecia kopen in belgie actos tablet fiyat prometrium 100mg prices where to buy amlodipine besylate online. Amlodipine 120 Pills 10mg $149 - $1.24 Per pill buy amlodipine 5mg online uk propecia finasteride kopen dosage of biaxin for bronchitis. Prometrium capsules price prometrium price walgreens prometrium price prometrium prices compare dosage of biaxin for sinus infection. Actos tablets 30mg actos 15 mg tabletten biaxin for strep throat dosage amlodipine besylate 5mg buy online best price for prometrium biaxin for strep dosage. Actos met tabletas prometrium capsules price amlodipine for sale amlodipine benazepril for sale propecia waar kopen. Amlodipine 5mg for sale amlodipine buy online actos 30 mg tablet price amlodipine buy online biaxin dosage for strep throat. first medicine online pharmacy store discount code prozac kaufen online buy amlodipine besylate online.

  • telmisartan amlodipine tablets price
  • first medicine online pharmacy discount code
  • amlodipine 5mg price uk
  • first medicine online pharmacy store
  • what is the cost of amlodipine besylate 5mg
  • generic pharmacy list of medicines
  • what is the cost of amlodipine 5mg
  • generics pharmacy price list of medicines

< Robaxin tablets :: Generic imitrex price >

As a web developer, we often need to display dates in our website. As a web user myself, I don’t like to read full dates like “26 November 2011 11:30PM” because it takes me a little while to interpret the date. I prefer reading smart dates like “1 hour ago” or “6 months ago”. Therefore, here I wrote a quick and simple function in PHP that display the time difference/elapsed based on a given timestamp value.

PHP Smart Date Function

Simple PHP Smart Date Function
by Zen (
function smartdate($timestamp) {
	$diff = time() - $timestamp;
	if ($diff <= 0) {
		return 'Now';
	else if ($diff < 60) {
		return grammar_date(floor($diff), ' second(s) ago');
	else if ($diff < 60*60) {
		return grammar_date(floor($diff/60), ' minute(s) ago');
	else if ($diff < 60*60*24) {
		return grammar_date(floor($diff/(60*60)), ' hour(s) ago');
	else if ($diff < 60*60*24*30) {
		return grammar_date(floor($diff/(60*60*24)), ' day(s) ago');
	else if ($diff < 60*60*24*30*12) {
		return grammar_date(floor($diff/(60*60*24*30)), ' month(s) ago');
	else {
		return grammar_date(floor($diff/(60*60*24*30*12)), ' year(s) ago');
function grammar_date($val, $sentence) {
	if ($val > 1) {
		return $val.str_replace('(s)', 's', $sentence);
	} else {
		return $val.str_replace('(s)', '', $sentence);

Basically I defined 2 functions above:
smartdate – calculates the difference between given timestamp and current time, then returns the correct sentence
grammar_date – modifies the returned sentence to plural form or singular form


The usage is simple and straightforward.

//example 1
echo smartdate($yourtimestamp);
//example 2
echo 'Posted on '.smartdate($yourtimestamp); 

By default, this function returns the floor() value, i.e: instead of returning “1.7 years ago”, it returns “1 year ago”. Anyway, the function can be easily modified to suit your specific needs.

Give users the choice to view the full date

1 disadvantage of smart date is of course, it reduces the level of detail and granularity of the date information. For example, dates of 13 months ago or 19 months ago will both be displayed as “1 year ago”.

The most common way to let user view the full date is to add a “title” attribute with full date as the attribute value. Now, when user mouseover your smart date, they can see the full date popping up as tooltip. Facebook uses this approach.

//from example 2 above
echo 'Posted on <span title="' . $originalfulldate . '">' . smartdate($yourtimestamp) . '</span>'; 

Hope this helps.


Posted by Zen on 12 December 2011 • 42,238 visits 0 comment
Tags :

or Subscribe to specific category only :


No comment yet. Be the first to leave a comment!

Leave a Reply

You must be logged in to post a comment.

Previous Post
Next Post