Gossamer Forum
Home : Products : DBMan SQL : Discussion :

date_NOT_set_format

Quote Reply
date_NOT_set_format
Hi, it works, but only half !

I attempt to create a field, which will contain date of the record's creation (or last record's modification) in such format: "%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%".

I attempted to work both with a DATE and with a TIMESTAMP.
All works fine, while the question is inserting date into the necessary field in Add_form.
I use this global (named get_date):

sub {
my $field_name = shift;
my $tags = GT::Template->tags;
my $home = $tags->{home};
require GT::Date;
GT::Date::date_set_format('%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%');
$home->{db}->cols->{$field_name}->{default} = GT::Date::date_get();
}

.. and this tag, as a value for "Date" field in Add_form:
<%get_date('Date')%>

So, in Add_form, before I click "Submit" button, (both with a DATE and with a TIMESTAMP) date appears as: "2003-05-01 22:17:04".
But after submitting, in the Record_form, it appears as "20030501221704" (when used TIMESTAMP) and as "2003-05-01" (when used DATE).

What's the matter? What's wrong?

Paul
Quote Reply
Re: [Skiff] date_NOT_set_format In reply to
I have understood.
If the problem consists in simply publishing date of creation or updating of record, it is not necessary to use DATE or TIMESTAMP fields. Just use CHAR and everything is all right!

Am I wrong?

Paul