PDA

View Full Version : Simple Date Format Question to get a script to work



IrwinMFletcher
03-07-2008, 08:48 PM
1) Script Title: Local Time Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/localtime.htm

3) Describe problem:

In the script it asks to define the date format for the SSI servermode and then has part of the section commented out. I have tried a couple of different things but it always breaks the script.

I went to the page with the script and viewed the source. When I copy that exactly the script "works" but not correctly.

Here is what I mean:

var servertimestring=(servermode=="server-php")? '<? print date("F d, Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<%= Now() %>'


The confusing part is:

'<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->'

When the page soruce is viewed I get this:

var servertimestring=(servermode=="server-php")? '<? print date("F d, Y H:i:s", time())?>' : (servermode=="server-ssi")? 'March 07, 2008 14:39:23' : '<%= Now() %>'

The problem with that is that when the page is refreshed the time is started over from the date and time shown in the source code. In this case, MArch 7, 2008 at 14:39:23. So if I refresh the page a week from now it will start counting from that date and not the current server time.

What am I suppose to put in the script for a date format?

I would like to have the date displayed like this:

Friday, March 07, 2008 14:39:23

If the page is refreshed the clock should just display the correct time - just like it does on the Script's home page.

Thanks in advance.

ddadmin
03-07-2008, 09:16 PM
Please post a link to the page on your site that contains the problematic script so we can check it out.

IrwinMFletcher
03-07-2008, 09:19 PM
it's on a dev server with restricted access - Let me see what I can do