NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page Simple Date Output! [PHP]

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
7 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 12-26-2006, 12:21 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
Ryder's Avatar
Join Date: Mar 2006
Posts: 227
Ryder is a jewel in the roughRyder is a jewel in the roughRyder is a jewel in the rough
 



Simple Date Output! [PHP]


Every wonder how larger corporate sites have the date displayed and automatically changed everyday? Javascript? No there is a much more easier way than that!

Simple put:
PHP Code:
<? echo date ("l, F j, Y"); ?>
This will output:
????: NamePros.com http://www.namepros.com/code/273463-simple-date-output-php.html
Tuesday, December 26, 2006

More tutorials coming soon at:
http://www.netsuhi.com
__________________
| HexRde.com | NetSuhi.com |
Ryder is offline  
Old 12-26-2006, 12:46 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,792
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
www.php.net/date

...
Dan is offline  
Old 12-26-2006, 01:38 PM   #3 (permalink)
NamePros Regular
 
DylanButler's Avatar
Join Date: Jan 2006
Location: San Diego, CA
Posts: 734
DylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to beholdDylanButler is a splendid one to behold
 



This requires your page extension to be .php by the way

edit: I should read the title aduurrr
DylanButler is offline  
Old 12-26-2006, 01:46 PM THREAD STARTER               #4 (permalink)
NamePros Regular
 
Ryder's Avatar
Join Date: Mar 2006
Posts: 227
Ryder is a jewel in the roughRyder is a jewel in the roughRyder is a jewel in the rough
 



Dan: Thanks for that pointer! It is just ppl are lazy and some just rely on these type of posts

Thanks!
__________________
| HexRde.com | NetSuhi.com |
Ryder is offline  
Old 12-26-2006, 02:02 PM   #5 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,565
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
Originally Posted by DylanButler
This requires your page extension to be .php by the way

edit: I should read the title aduurrr
Not strictly
Matthew. is offline  
Old 12-28-2006, 10:17 AM   #6 (permalink)
NamePros Regular
Join Date: Feb 2006
Posts: 584
jerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to all
 



Just FYI, there are javascript solutions that can do the job much better.

Those javascript clocks can update the time in realtime, as its clientsided.
jerometan is offline  
Old 12-28-2006, 11:28 AM   #7 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,565
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
Client side solutions are rarely is ever better. Anything that depends on a condition (such as javascript being enabled) shouldn't be relied on if it is important.
Matthew. is offline  
Old 12-29-2006, 03:03 AM   #8 (permalink)
NamePros Regular
 
beaver6813's Avatar
Join Date: May 2005
Location: England
Posts: 390
beaver6813 is a jewel in the roughbeaver6813 is a jewel in the roughbeaver6813 is a jewel in the rough
 




suhithar i dont mean to be rude and i know you're trying to help, but if most people want to learn the date function they will just search on php.net where it has plenty of examples. Focus on writing a worthwhile script than just giving examples of lots of php functions.
beaver6813 is offline  
Old 01-01-2007, 01:49 PM   #9 (permalink)
Account Suspended
 
DeViAnThans3's Avatar
Join Date: Apr 2006
Location: Belgium
Posts: 442
DeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to all
 



Originally Posted by Matthew.
Client side solutions are rarely is ever better. Anything that depends on a condition (such as javascript being enabled) shouldn't be relied on if it is important.
I basically agree with it; though, PHP is mostly not realtime, and that's a big disadvantage - especially when it is about time or date functions
It is also so that PHP itself is unabled to detect the timezone of the visitor (you can guess the timezone of course with IP2country databases and so of course, but thats just guessing), so it will just show the time of the server mostly - and a visitor might get confused by the time then.

PHP does can detect if javascript is enabled on the useragent of the browser. So what the best thing is to do in my opinion about showing time or date, is letting PHP see if the browser has javascript enabled (=> browscap), and if javascript is enabled, use the javascript function. Else print server time, or GMT time (gmdate()) and a clear statement of which timezone the time displayed is.
????: NamePros.com http://www.namepros.com/showthread.php?t=273463
.. just a suggestion though
DeViAnThans3 is offline  
Old 01-13-2007, 06:03 AM   #10 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



you could have a "change your timezone" link as well if you wanted. and store the user's preference in a session, or even better a cookie. I cba to go into it at the moment, but its easy enough to look up cookies and sessions on php.net as well.

Tom
PoorDoggie is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 03:21 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger