Forums

This topic is locked

Date Again......

Posted 23 Nov 2001 10:30:34
1
has voted
23 Nov 2001 10:30:34 Oli Wilkinson posted:
I've set up a simple MySQL news database with two rows - one for the date and one for the text.

How do i set the my "date" row to automaitcally show the date and of the entry?

Something like this would be nice:

"Friday 15 December"

It's probably very simple, but being a novice I need all the help I can get!!!!

Cheers

Replies

Replied 23 Nov 2001 10:58:29
23 Nov 2001 10:58:29 Owen Eastwick replied:
Try the following:

Set the default value of the field to <b>Now()</b>

Also take a look at TIMESTAMP:

TIMESTAMP(2) = YY
TIMESTAMP(4) = YYYY
TIMESTAMP(6) = YYMMDD
TIMESTAMP(8) = YYYYMMDD
TIMESTAMP(10) = YYMMDDHHMM
TIMESTAMP(12) = YYMMDDHHMMSS
TIMESTAMP(14) = YYYYMMDDHHMMSS

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 23 Nov 2001 12:01:27
23 Nov 2001 12:01:27 Oli Wilkinson replied:
Many thanks for that! However, is there a way to format the date differently to the TIMESTAMP default? Like having DDMMYYYY or something?

Replied 23 Nov 2001 20:12:18
23 Nov 2001 20:12:18 Owen Eastwick replied:
I'm afraid you've got me there, not that hot with MySQL.

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 23 Nov 2001 21:05:45
23 Nov 2001 21:05:45 Oli Wilkinson replied:
Thanks anyway!

Replied 23 Nov 2001 23:40:03
23 Nov 2001 23:40:03 Tim Green replied:
There are a number of ways to format the date and time, either independantly or together.

Here is a (non-exhaustive) list of functions that deal with exactly this, along with links to where you can find them on the php online manual:-

<b>date()</b>
www.php.net/manual/en/function.date.php

<b>strftime()</b>
www.php.net/manual/en/function.strftime.php

<b>mktime()</b>
www.php.net/manual/en/function.mktime.php

<b>gmdate()</b>
www.php.net/manual/en/function.gmdate.php

Hope this helps <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>

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