Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Dates coming up as 0000-00-00 even when date format changed

Quote Reply
Dates coming up as 0000-00-00 even when date format changed
Hi-

I looked for a solution to my problem in the forum, but I didn't find anything so I'm posting a new message. Here goes :) ::

I've imported my dbman flatfile db to dbmanSQL and all the dates are coming up as 0000-00-00. The format I used in dbman is MMM-DD-YYYY. So inorder for both formats to match I changed the Date.pm so that the format is MMM-DD-YYYY. However, this didn't help. What else do I need to change so that the date doesn't come up as all zeros? Unsure

Thanks!
Reena
Quote Reply
Re: [Reena0330] date 0000-00-00 In reply to
Anyone out there? There's probably a very simple solution to this problem, but I don't know what the solution is....help please Frown



I tried adding the following subroutine:

sub {
my $field_name = shift;
my $tags = GT::Template->tags;
my $home = $tags->{home};
require GT::Date;
$home->{db}->cols->{$field_name} = GT::Date::date_set_format('%mmm%-%dd%-%yyyy%');
return $values->{$field_name};
}



But it doesn't work.. :(
Reena

Last edited by:

Reena0330: Aug 13, 2002, 2:02 PM
Quote Reply
Re: [Reena0330] date 0000-00-00 In reply to
Have you called this template global within your templates? if not, you should add:

<%template_global_name%> into your templates.

Btw, you will find so many threads which concern with this issue on our forum.

TheStone.

B.

Last edited by:

TheStone: Aug 13, 2002, 3:36 PM
Quote Reply
Re: [TheStone] date 0000-00-00 In reply to
I looked through all of the threads, but I couldn't figure out how to solve the problem.

Also, yes I did call the subroutine from within my templates:

<%format_date('creationdate')%>

I also tried:

<%format_date(creationdate)%>

but all I get is errors. Is my subroutine correct?
Reena
Quote Reply
Re: [Reena0330] date 0000-00-00 In reply to
Can you post the error message?

B.

Last edited by:

TheStone: Aug 13, 2002, 4:41 PM
Quote Reply
Re: [TheStone] date 0000-00-00 In reply to
I get the following error:

Unable to compile 'format_date'. Reason: at /auto/cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/admin/Dbsql/Home.pm line 1145. Unable to compile 'format_date'. Reason: at /auto/cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/admin/Dbsql/Home.pm line 1145.
Stack Trace
======================================
Dbsql (3890): Dbsql::Home::__ANON__ called at /auto/cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/admin/GT/Template.pm line 684 with arguments
(creationdate).
Dbsql (3890): GT::Template::_call_func called at /auto/cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/admin/templates/default/compiled/search_results.html.compiled line 407 with arguments
(GT::Template=HASH(0x597368), format_date, creationdate).
Dbsql (3890): GT::Template::__ANON__ called at /auto/cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/admin/GT/Template.pm line 539 with arguments
(GT::Template=HASH(0x597368)).
Dbsql (3890): GT::Template::_parse called at /auto/cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/admin/GT/Template.pm line 89 with arguments
(GT::Template=HASH(0x597368), search_results.html, HASH(0x5cc32c)).
Dbsql (3890): GT::Template::parse called at /auto/cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/admin/Dbsql/Home.pm line 116 with arguments
(GT::Template, search_results.html, HASH(0x5e5498), HASH(0x5cc32c)).
Dbsql (3890): Dbsql::Home::print called at /auto/cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/admin/Dbsql/Home.pm line 76 with arguments
(Dbsql::Home=HASH(0xb4fec), search_results.html, HASH(0x5e5498)).
Dbsql (3890): Dbsql::Home::process called at /cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/db.cgi line 29 with arguments
(Dbsql::Home=HASH(0xb4fec), in, GT::CGI=HASH(0x54dc5c), sql, GT::SQL=HASH(0x56d9ac), cfg, Dbsql::Config=HASH(0x231ca4)).
Dbsql (3890): main::main called at /cweb0/www-home/virtual/wwwin-gsbu/cgi/seg/dbman_SQL/db.cgi line 22 with no arguments.

Reena