Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Changing a field from text to date

Quote Reply
Changing a field from text to date
I manually creted a field in my Links section under database with the ff definitions
columntype null type form display and form type CHAR(200) Yes Expiry TEXT


It was for an expiry date in the format August 31, 2004
I tried to change the column type and formtype to Date but it gives me 0000-00-00
I want to maintain the data in the table even after changing the column type and form type from text to date

How do I do that?
Quote Reply
Re: [Abusaki] Changing a field from text to date In reply to
DB Date format would be yyyy-mm-dd. On User end displaying the dates you could play with the GT::Date::date_set_format and change the format in which you would want the user to see. Refer GT::Date documentation from the Help Section.

Also if payment support is being used (V2.2.0) then Expiry Dates feature is already builtin. If it is otherwise then you would need to do as above...

HyTC
Quote Reply
Re: [HyperTherm] Changing a field from text to date In reply to
Thank you HyperTherm,
I already manually entered the date in this format Month day, year for all the links and I was deleting all the links manually,
I want the links to be deleted when expiry date is reached, but when I change the properties of the column to date from text, it all goes to 0000-00-00
Quote Reply
Re: [Abusaki] Changing a field from text to date In reply to
DATE type can only hold data in yyyy-mm-dd or at best with time if it's a DATETIME column. In A DATE Column you cannot have a Date format like August, 25 2004. (Maestros Correct Me If I Am Wrong ;) )

For expiry, if it's impossible for you to use the builtin Expiry Feature (in V2.2.0) then in the include_form.html you could pass dates as hidden field(s) ... so that you do not need to enter "Manually"...

Use the GT::Date stuff for passing dates as hidden fields along with correct value in the right format (yyyy-mm-dd) and it would be submitted to Links table... This is in case you are going to use an external script for expiring Links...

HyTC
Quote Reply
Re: [HyperTherm] Changing a field from text to date In reply to
Thanks Hypertherm,
Is there any way I can convert all the data in the Expiry field fromt eh format August 23, 2004 to 2004-08-23, Since I have over a thousand links in the database.


====Problem 2====
I also have this problem
Before I upgraded to version 2.2.0, I added aome extra fields like shipping info and others.
I upgraded to the 2.2 version, imported my links and and did a resync database after importing the links thinking they will be synced witht he new fields in the new version.
Well I have lost all the new fileds in the new version but have my old fileds in the old version. How Do I keep both fileds in both versions
Quote Reply
Re: [Abusaki] Changing a field from text to date In reply to
In case your Expiry Date is at fixed interval with rspect to Add-Date in Links table, perhaps you could try UPDATE of Expiry Date column with a value Adding that fixed interval to Add_Date. Not to sure on this though... refer Mysql Docs...

Wth Respect To Columns not there upon Post Upgrade resync, if you are checking from the Admin interface, this is normal that you do not find new columns added once you do a resync. Check the tables ... resync shouldn't/wouldn't alter table...

HyTC

Last edited by:

HyperTherm: Aug 26, 2004, 8:20 AM