Server Data Type Settings

Status
Not open for further replies.

griffin

Member
Hi All

I feel a little silly here but what Data Type should a Date element be set to on the server? It seems obvious but for some reason when looking at my tables on the server via phpMyAdmin I get some Date elements that have Type as VARCHAR where others are set to DATETIME. Does it have anything to do with changing the format to 'd-m-Y'?

I assumed when creating the element that Fabrik would magically set the Type to the appropriate one - which for a Date element would presumably be DATE or DATETIME (not VARCHAR). This appears to not always be the case for some strange reason.

So my questions are:

1. Should all Date elements be either Type = DATE or DATETIME?
2. Should I change the Type on the server?
3. Will changing the Type on the server cause any data loss or other problems?
4. If changed will it update all records automatically in that table?
5. Also, where I have a Date element and I don't want to show the time - just 'd-m-Y' - should that Type be set to DATE rather than DATETIME?

Cheers
 
This is strange.
Is your Fabrik element really of type/plugin "date"? Or is it just a normal "field" element with element name= "date".

A Fabrik "date" plugin is a DATETIME, "time" plugin is TIME, "birthday" plugin is "DATE".
 
1. if the plugin name is date, then yes. As troester said above, DATETIME is its core datatype.
2. Depends on your list settings. If it set to modify db structure then no, just resave. A message appears about changing the field data type to DATETIME, then you confirm that you want it.
3. If your spelling is right then no. '2015-04-20 11:32:00' should stay the same when changing from varchar to datetime. Changing to DATE will loose forever the time information. Restoring back to datetime will then result '2015-04-20 00:00:00'
4. Yes and no - see previous
5. Then use rather birthday element - you will not have any timezone related issues and you can use very old dates if needed (like 0001-01-01 :)). Even better is to use both birthday and time element (to have separate DATE and TIME fields) - in cases you may need the time value in some records.
 
Thanks very much for responses.

I did check that they were actually Date elements - all Birthday and date_time elements were correct just a couple of Date elements (not all) were VARCHAR. I shall change them.

Out of interest - if a Field element is used for dates should their type be set to DATE?
 
erm I would really not recommend storing dates in fields. Thats what the date element is for.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top