Jump to content

Date Script


webgyrl

Recommended Posts

Does anyone know where I might be able to get a Date Script that displays like the one on this site

www.recording.org

 

See the left hand side where it shows date in this format:

July 5, 2004

 

If anyone knows of a script that shows the date in this format that also has the time, I'd appreciate a link.

 

I've been browsing HotScripts but haven't found exactly this format yet.

 

Thanks,

Nat

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Hey guys,

 

I just did this for a new site I am working on, and for some reason the date and time are not showing on the page.

 

The code I used is as follows:

><?php
echo date("F d, Y @ g:i:s A");
?>

 

Any reason this would not show up.

 

Check page here:

http://www.sanctuarylane.com/ dttest.htm (remove space)

 

Weird.

 

Did I miss a step? Do I need to upload some other script or something? All I did was put this PHP code in the body.

Edited by webgyrl
Link to comment
Share on other sites

Hi Don!

 

That worked! I forgot about changing the htaccess file!

 

For some reason the time is reading 2 hours off. I am not sure why that is. Shouldn't the time sych to the users computer?

 

I've got it here now: http://www.sanctuarylane.com/ index1.htm

The site isn't done yet.... just getting content etc.

 

Also have this weird thing going on in Firefox where it is showing the slice name "sls_layout" between the Gear and Resources buttons. Can't for the life of me figure out why this is so. It is not appearing in IE. I sliced this and exported it to DW using Fireworks.

 

Really strange! :pissed:

 

wampthing Thank you kindly!

Link to comment
Share on other sites

Oh goodness gracious... OK I see a bunch of stuff on that PHP primer about DST and time zones and I totally forgot about that. How in the heck would I re-write what I have to reflect Eastern US Time... I think we are DST right now....

 

><?php
echo date("F d, Y @ g:i A");
?>

 

How do I change this?

 

Why do I always do these things while exhausted? LOL :pissed:

Link to comment
Share on other sites

Webgrl,

 

Ok so this is a copy and paste, but it does the job!

 

><?php

// melbdate.php3
// rename file extension from .txt to .php3
// or to .php (updated April 2003)

// Script copyright (C) 2000 Dean Kennedy, Terrabyte Communications
// Version 1.02 06 November 2003
// Free to use, modify and copy so long as you leave the above
// two lines in comments. You can safely delete all other comments
// and just leave the four line script

// Distributed under the terms of the GNU General Public License (GPL).
// Because it is licensed free of charge, there is NO WARRANTY, it is
// provided AS IS. The author can not be held liable for any damage that
// might arise from the use of this software. Use it at your own risk.
// http://www.gnu.org/copyleft/gpl.html

// To adjust the format of the date, see the list of variables at the
// official PHP site (php.net): http://www.php.net/manual/function.date.php
//
// If your local time is *behind* the server time, then change the "+" to
// a "-" in the $melbdate line
// 
// Keep in mind that you'll have to update the $hourdiff variable within the
// script when your *local* daylight saving time/standard time changes, if
// it is a different setting to the server daylight saving/standard time

// Variable for hours

$hourdiff = "14"; // hours difference between server time and local time

// If you don't know how many hours, then "uncomment" the three lines
// below by deleting "// " to see what the server time is (remember to
// put the comments "// " back when you've finished checking:

// $serverdate = date("l, d F Y h:i a");
// print ("$serverdate");
// print ("   <p>");

// Nothing needs to be changed below here unless you want to change
// the format of the date (see above for URL of options) or your local
// time is behind the server time

$timeadjust = ($hourdiff * 60 * 60);

$melbdate = date("l, d F Y h:i a",time() + $timeadjust);

print ("$melbdate");

?>

Link to comment
Share on other sites

Hi Nat,

 

Try

Or you can use the putenv("TZ=required_timzone")

 

Andy: the reuslt I get is this: March 01, 2006 @ 3:03 PM -25200-18000

 

I really haven't done enough readying to output the time right. I will have to get to that... geez there are not enough hours in the day for me these days. LOL

 

I'm just doing this site as a favor to a friend, so if I can't get that time right, then I will just leave it out, cuz I have not got a zillion hours to figure it out.

 

But I really want to at least try... but that PHP stuff is confusing to me most times!

Link to comment
Share on other sites

Webgrl,

 

Ok so this is a copy and paste, but it does the job!

 

><?php

// melbdate.php3
// rename file extension from .txt to .php3
// or to .php (updated April 2003)

// Script copyright (C) 2000 Dean Kennedy, Terrabyte Communications
// Version 1.02 06 November 2003
// Free to use, modify and copy so long as you leave the above
// two lines in comments. You can safely delete all other comments
// and just leave the four line script

// Distributed under the terms of the GNU General Public License (GPL).
// Because it is licensed free of charge, there is NO WARRANTY, it is
// provided AS IS. The author can not be held liable for any damage that
// might arise from the use of this software. Use it at your own risk.
// http://www.gnu.org/copyleft/gpl.html

// To adjust the format of the date, see the list of variables at the
// official PHP site (php.net): http://www.php.net/manual/function.date.php
//
// If your local time is *behind* the server time, then change the "+" to
// a "-" in the $melbdate line
// 
// Keep in mind that you'll have to update the $hourdiff variable within the
// script when your *local* daylight saving time/standard time changes, if
// it is a different setting to the server daylight saving/standard time

// Variable for hours

$hourdiff = "14"; // hours difference between server time and local time

// If you don't know how many hours, then "uncomment" the three lines
// below by deleting "// " to see what the server time is (remember to
// put the comments "// " back when you've finished checking:

// $serverdate = date("l, d F Y h:i a");
// print ("$serverdate");
// print ("   <p>");

// Nothing needs to be changed below here unless you want to change
// the format of the date (see above for URL of options) or your local
// time is behind the server time

$timeadjust = ($hourdiff * 60 * 60);

$melbdate = date("l, d F Y h:i a",time() + $timeadjust);

print ("$melbdate");

?>

 

Thanks Jim, I will try this as well.

 

Do I have to create a php3 file to work this? Sorry, it's confusing me a bit.

 

I really thought I could do this with a few simple lines of code :)

Edited by webgyrl
Link to comment
Share on other sites

You can use .php or in your case .html

 

 

OK... I think there are more detailed instructions... gotta find out what the code is to use to point to the script.

 

Will do that later... having CSS stylesheet debugging session right now! LOL

 

Thanks for the help guys!

Link to comment
Share on other sites

Nat,

 

I've just tried the code

><?php
echo date("F d, Y @ g:i A T");
echo "<br/>";

putenv("TZ=MST");
echo date("F d, Y @ g:i A T");


echo "<br/>";

putenv("TZ=GMT");
echo date("F d, Y @ g:i A T");

?>

 

And that gives me

March 01, 2006 @ 6:03 PM EST

March 01, 2006 @ 4:03 PM MST

March 01, 2006 @ 11:03 PM GMT

 

If that helps

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...