Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Basic Date Script ...
Old 07-02-2005, 11:45 PM Basic Date Script ...
MightyMaster's Avatar
Ultra Talker

Posts: 401
Location: Appleton, WI
Trades: 0
Looking for a basic PHP date script that I can modify. I want to show the date in two different styles in twp different places on my website.

1. Saturday July 2, 2005
2. July 2, 2005
MightyMaster is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-03-2005, 04:16 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
sure you don't want a javascript solution, as a PHP script will show the server time and date

PHP Date & Time
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-03-2005, 06:41 AM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
PHP Code:
<?php
$today 
getdate();
$day $today['mday'];
$weekday $today['weekday'];
$month $today['month'];
$year $today['year'];
?>
To produce the results you want use:
PHP Code:
<? echo $weekday $month $day$year ?>
which will give "Saturday July 2, 2005"

and:
PHP Code:
<? echo $month $day$year ?>
to give "July 2, 2005"

As chrishirst rightly points out this is the server date, and you will need a client sided JavaScript solution for a client date.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Old 07-03-2005, 11:24 AM
Rufo's Avatar
Extreme Talker

Posts: 173
Trades: 0
Quote:
Originally Posted by onlyplace4
To produce the results you want use:
PHP Code:
<? echo $weekday $month $day$year ?>
which will give "Saturday July 2, 2005"

and:
PHP Code:
<? echo $month $day$year ?>
to give "July 2, 2005"
You appear to have forgotten the inverted commas. Should be as follows:
PHP Code:
<? echo "$weekday $month $day$year"?>
PHP Code:
<? echo "$month $day$year"?>
Alternatively, simply use the PHP date() function (much simpler):
PHP Code:
<? echo date('l F j, Y'); ?>
PHP Code:
<? echo date('F j, Y'); ?>
Rufo.
__________________

Please login or register to view this content. Registration is FREE
Rufo is offline
Reply With Quote
View Public Profile Visit Rufo's homepage!
 
Old 07-03-2005, 11:37 AM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
Oooooooooooops

Forgot about the date() function ... think I need to go read the manual again
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Reply     « Reply to Basic Date Script ...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.74703 seconds with 12 queries