CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 DATE vs. DATETIME - PHP/MySQL

Print topic Send  topic

Author Message
jrichter
Posted: 04/14/2002, 12:16 PM

I've just started working with CodeCharge a little more deeply and am using it to create an administration interface for a user registration system I had previously developed. Users in my MySQL database have several DATETIME fields in their records.

However, using the "DATE" datatype (which is the default which pops up for the fields in question in CC) I find two problems:

1) The field is only displayed as 10 characters (fine for a date without time, but not a MYSQL DATETIME field.

2) Writing to the field with a new valid date/time value (e.g. 9999-12-31 23:59:59) truncates the time component.

The questions are:

a) Why isn't there a DATETIME data type in CC to match the same data type in MySQL?

b) Other than manually forcing the field to have a display width of 19, and be of type text to trick things, is there any more automated way to handle manually entered DATETIME data via CC?

Jake
Alex Alexapolsky
Posted: 04/15/2002, 2:18 AM

CC date is not a mysql date type. This is something general.
You can think of this as of date-time type or
date type , depending on situation.
jrichter
Posted: 04/15/2002, 6:40 AM

I guess what I'm saying is that if CC detects a given field in a source MySQL database is DATETIME, it shouldn't convert that to a CC DATE field automatically when creating forms. Either it should make it a TEXT field 19 characters wide (which works just fine), or at least let the user, in preferences indicate how to translate the MySQL data type to a CC data type.

Jake
Nicole
Posted: 04/15/2002, 7:07 AM

Hello,
CC doesn't convert date/time fields to CC date format (for any db). CC doesn't convert date fields at all. It treats date/time fields as common text fields. So if you need some convert you should do it manually before displaying field on the form or before passing the value to db.
jrichter
Posted: 04/15/2002, 7:11 AM

Nicole,

You're not understanding - I'm not talking about conversions. I'm talking about the fact that CC erroneously assumes that any source database field containing a date type of any sort should be the Date type CC uses.

Let me be more specific. If I create a form in CC and select a field from my MySQL database which has a MySQL data type of DATETIME, CC adds that field in the field list as a TextBox of size 10. That's the first thing that's wrong. A MySQL DATETIME field should have a size of 19 (the MySQL DATETIME field has a format of "YYYY-MM-DD HH:MM:SS", which is 19 characters).

The second thing that's wrong is if I click on the field properties icon for said field in the field list, the Data Type option is set to "Date". That is also wrong, as the CC Date type truncates entries such that the time portion is removed when the form is submitted. The correct solution would be for the Data Type option to be "Text" instead of "Date" when the input type from a MySQL table is DATETIME, and should have a max length of 19. Doing this resolves the problem.

Jake

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.