468,249 Members | 1,469 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

date() gives me yesterday's date and not today's - why?

$result[$i]->record_entered contains the current date as set up by
MySQL (entered as "now()").

I verified that in the database the date is "now()", which in this case
will be "2/9/2006".

However, when viewing the page using the display:

[PHP]<?= date('n/j/Y', strtotime($result[0]->record_entered)) ?>[/PHP]

I get "2/8/2006" instead, even though the database back-end says
"2/9/2006". What's going on?

Thanx
Phil

Feb 9 '06 #1
15 1761
Check the $result[0]->record_entered variable, change it to normal text
, using http://www.4webhelp.net/us/timestamp.php

Of anything, i suggest that you don't use <?= , etc. use ONLY <?php
echo (date()); ?>

Just print_r the $result array !

Seems that the server is somewhere far away from where you live :)

Feb 9 '06 #2
Yeah it was a serious case of brain freeze. I had
$result[0]->record_entered, when I was supposed to have
$result[$i]->record_entered.. but I fixed it 3 minutes before the
presentation!

Phil

Drakazz wrote:
Check the $result[0]->record_entered variable, change it to normal text
, using http://www.4webhelp.net/us/timestamp.php

Of anything, i suggest that you don't use <?= , etc. use ONLY <?php
echo (date()); ?>

Just print_r the $result array !

Seems that the server is somewhere far away from where you live :)


Feb 9 '06 #3
You're living in the past or you are using an incorrect timezone.
Have you considered switching to stardate?

Feb 9 '06 #4
"Drakazz" <ti****@hakeris.co.uk> wrote:

Of anything, i suggest that you don't use <?= , etc. use ONLY <?php
echo (date()); ?>


Why? <?= reads better, and there's no particular performance penalty.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Feb 11 '06 #5

Tim Roberts wrote:
"Drakazz" <ti****@hakeris.co.uk> wrote:

Of anything, i suggest that you don't use <?= , etc. use ONLY <?php
echo (date()); ?>
Why? <?= reads better, and there's no particular performance penalty.


One would argue that you use <?php because it allows it to be
distinguished against <?xml or other nomenclatures. I personally think
that you would not normally compile your web server to view .xml files
as PHP or vice versa, but that's just me.

I think <? reads better myself

Phil

--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.


Feb 11 '06 #6
Tim Roberts wrote:
"Drakazz" <ti****@hakeris.co.uk> wrote:
Of anything, i suggest that you don't use <?= , etc. use ONLY <?php
echo (date()); ?>

Why? <?= reads better, and there's no particular performance penalty.


Until you need to move to a host which has short tags disabled - and you
need to go back and change all your code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 11 '06 #7
That's why they invented technical specs..

Phil

Jerry Stuckle wrote:
Tim Roberts wrote:
"Drakazz" <ti****@hakeris.co.uk> wrote:
Of anything, i suggest that you don't use <?= , etc. use ONLY <?php
echo (date()); ?>

Why? <?= reads better, and there's no particular performance penalty.


Until you need to move to a host which has short tags disabled - and you
need to go back and change all your code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Feb 11 '06 #8
Huh? What do specs have to do with portability?

<?= isn't portable. That means that using it will fail on some servers.
<?php echo... will run on any server where PHP is enabled regardless of
the server's configuration.

While you may have your development machine configured to accept the
malformed <?= syntax, once you move the code to a production server the
scripts may fail to parse correctly. As a result it is recommended by
the PHP Manual that developers: a) Disable short tag support on
development machines (to emulate the worst case scenario) and b) Never
use the short tags syntax.

The same holds true for "register globals" and other early PHP design
flaws.

-Robert

Feb 12 '06 #9
comp.lang.php wrote:
That's why they invented technical specs..


Technical specs have nothing to do with it. It's a configuration issue,
and even the PHP manual recommends against using short tags.

Also, please don't top post.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 12 '06 #10

Gary L. Burnore wrote:
On 11 Feb 2006 15:30:02 -0800, "comp.lang.php"
<ph**************@gmail.com> top posted like an ignorant moron and
wrote:
That's why they invented technical specs..


That makes very little sense.


I'm suddenly not surprised. Bottom line, it works, and that's that.
And this thread is turning into an expose on ADD-related
peacock-strutting over <? vs <?php when in the end it all works and the
customer doesn't even CARE if it's <? or <?php. A bad programmer can
use either one and still screw up a site and the customer fire him for
it not working, <?, <?php or otherwise.

You guys have got to learn how to view things from the non-clued
customer side of life. The people who ultimately keep YOU employed.

Phil

Feb 12 '06 #11
comp.lang.php wrote:
Gary L. Burnore wrote:
On 11 Feb 2006 15:30:02 -0800, "comp.lang.php"
<ph**************@gmail.com> top posted like an ignorant moron and
wrote:

That's why they invented technical specs..


That makes very little sense.

I'm suddenly not surprised. Bottom line, it works, and that's that.
And this thread is turning into an expose on ADD-related
peacock-strutting over <? vs <?php when in the end it all works and the
customer doesn't even CARE if it's <? or <?php. A bad programmer can
use either one and still screw up a site and the customer fire him for
it not working, <?, <?php or otherwise.

You guys have got to learn how to view things from the non-clued
customer side of life. The people who ultimately keep YOU employed.

Phil


Phil,

No, that's the point - it DOESN'T WORK!

It may work on your server. But there are thousands of hosts out there
which have short tags disabled - and your code won't run there.

I do look at it from the non-clued customers side of life. He can
migrate my site to another hosting service and it will still run.

And the customer WILL CARE.

You've got to learn how to program for more than just one isolated
environment. The world is not like that.

BTW - I agree with Gary. This is one of the things I look at when
hiring a sub - and if I see it, that person is immediately removed from
any possible consideration.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 12 '06 #12
On 2006-02-12, Gary L Burnore <gb******@databasix.com> wrote:
Until you need to move to a host which has short tags disabled - and you
need to go back and change all your code.


This makes perfect sense. How one can claim that <?= "reads better"
as a good reason to lose portability is beyond me. Too lazy to type
two more characters may be a more logical reason to use <?=.


Seven more characters, '<?=' means '<php echo '

Bye.
Jasen
Feb 12 '06 #13
You're going to keep up this pointless diatribe until you prove what?
That I got it to work and not by your means.

Please stop replying to this as I've completely moved on.

Phil

PS: I've top-posted! HA!

Jerry Stuckle wrote:
comp.lang.php wrote:
Gary L. Burnore wrote:
On 11 Feb 2006 15:30:02 -0800, "comp.lang.php"
<ph**************@gmail.com> top posted like an ignorant moron and
wrote:
That's why they invented technical specs..

That makes very little sense.

I'm suddenly not surprised. Bottom line, it works, and that's that.
And this thread is turning into an expose on ADD-related
peacock-strutting over <? vs <?php when in the end it all works and the
customer doesn't even CARE if it's <? or <?php. A bad programmer can
use either one and still screw up a site and the customer fire him for
it not working, <?, <?php or otherwise.

You guys have got to learn how to view things from the non-clued
customer side of life. The people who ultimately keep YOU employed.

Phil


Phil,

No, that's the point - it DOESN'T WORK!

It may work on your server. But there are thousands of hosts out there
which have short tags disabled - and your code won't run there.

I do look at it from the non-clued customers side of life. He can
migrate my site to another hosting service and it will still run.

And the customer WILL CARE.

You've got to learn how to program for more than just one isolated
environment. The world is not like that.

BTW - I agree with Gary. This is one of the things I look at when
hiring a sub - and if I see it, that person is immediately removed from
any possible consideration.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Feb 12 '06 #14
Hi,

Pls checkout your server time is of today ?

Regards,
Jatin

Feb 13 '06 #15
The server time is today, it was a coding error all along, but thanx

Phil

pjSoni wrote:
Hi,

Pls checkout your server time is of today ?

Regards,
Jatin


Feb 13 '06 #16

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by necromancer_stupidspambot | last post: by
16 posts views Thread by Donnal Walter | last post: by
4 posts views Thread by peashoe | last post: by
5 posts views Thread by Kermit Piper | last post: by
1 post views Thread by Joris De Groote | last post: by
2 posts views Thread by Thierry Lam | last post: by
21 posts views Thread by shelleybobelly | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.