Forums

PHP

This topic is locked

Convert Date String

Posted 07 Dec 2001 17:06:54
1
has voted
07 Dec 2001 17:06:54 Stephen Bateman posted:
Hi Everyone,

Again I am hoping someone here can help me out. What I need to do is convert a value of "yyyy-mm-dd" to "yyyymmdd" so I can do an IF less than statement on it.

Also if anyone has any pointers on a IF statement with a LESS THAN < clause, any help would be appreciated.


Thanks

GT

Replies

Replied 08 Dec 2001 01:32:48
08 Dec 2001 01:32:48 Tim Green replied:
OK... first of all the date. There are a few ways that you can do this, but if you are certain that the format will always be this you can use the following:-

$oldDate="yyyy-mm-dd";
$newDate=ereg_replace("-","",$oldDate);

and now the IF Statement:-

if (1 < 2) {
echo "Less Than";
}

For further queries regarding the syntax for IF statements please consult the PHP manual. A CHM (Windows Help Format) version is downloadable from www.php.net. I would highly recommend this as everything is categorised, and the manual is fully searchable.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic