Forums

PHP

This topic is locked

Date format problem with MYSQL and PHAKT on Linux

Posted 29 Sep 2001 12:29:23
1
has voted
29 Sep 2001 12:29:23 dyna c posted:


I'll try and explain

I want the current date to be returned to the record set page in the format day, month, and date, year when a record is created/updated.

Here are my steps

1. Set timestamp in MYSQL "type = TIMESTAMP" "Length/Set =14" "null=null"
This is what is in the MysQL date field "20010929145427"

2.created records set in Ultradev and add Dynamic Text for the date field

3. Format field with "Date - Monday, January 5th 2000"

The Output I get when using the format field is "Thursday, January 1st 1970 " . If I leave format to none 20010929145427 gets returned.

Any pointers greatly appreciated


Replies

Replied 01 Oct 2001 01:43:16
01 Oct 2001 01:43:16 Stephen Cox replied:
The Janurary 1, 1970 is the epoch date. Actually TIMESTAMP is tied to UNIX time, where 01011970 is the first day in the range.

The format is YYYYMMDDhhmmss. But, you can change that by adding a declaration to TIMESTAMP.. so TIMESTAMP(8) would store dates in the YYYMMDD format. Try that, that may fix the problem. I'm not sure which formating fuction you are using to display TIMESTAMP.

Stephen Cox
web.net geek for nonprofits and political campaigns.
Replied 01 Oct 2001 08:48:44
01 Oct 2001 08:48:44 Tim Green replied:
By far the easiest way to do this is to create a 14 digit TIMESTAMP using the PHP Date() command:-

$date=date("YmdHms";

There is however a much easier method, thanks to ADODB.

See the 'Inserting Date' thread for that solution, which I would heartily recommend as it is cross db compatible.

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>

Edited by - rawveg on 10/01/2001 08:52:13

Reply to this topic