Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

User Friendly Dates

Quote Reply
User Friendly Dates
Does exist a way to use dates in the nice format DD-Mmm-YYYY like Links2 instead of YYYY-MM-DD???

This is a big problem because I guess Alex did this change because SQL standard needs this format... Months ago I did a very big mod on links2 that uses dates in the old format to produce event-calendars and would import it into LinksSQL.


Does anyone have the same problem?

Thanks in advance


Lepo
Quote Reply
Re: User Friendly Dates In reply to
Hello!

Would you like to my list of nightmares?

Yes I have similar problems but slightly different then yours. The damn microsoft Access give birth of a row having a date only with date + time.

I am trying to find a program that finds and replaces to time |date 00:00:00| = |date| faster as replacing 10,000 links database is quite something! This took once 15 minites. So if I have to update my database often I have to calculate into how many nightmares I have to pass through before I bring this free service database on the net!!! Have a good time solving this date thing as much as I am having now Smile Wink

------------------
rajani











Quote Reply
Re: User Friendly Dates In reply to
Hello,
when you import the db to access just change the format from date to text. Then the 00.00.00 will disappear.
Quote Reply
Re: User Friendly Dates In reply to
rajani,

You've said several times now that this missing day is bothering you. MySQL is a database. There has to be a simple command you can execute to have it find all missing dates and replace them with today's date, or any arbitrary date you wish.

I'm not good enough with SQL yet to come up with it, but I'm sure Alex can give you the few commands, or someone else who knows SQL can.

This is a simple replace a field in the database, not a "links" problem.

Give me a few more days and I may have the solution. I'm diving into this more and more and once Alex releases the next version of LinkSQL and I know where he's going with it, I'll have some minor mods released.

He seems to be building in some of the features, so I'd rather wait for the official version.
Quote Reply
Re: User Friendly Dates In reply to
rajani,

I was playing with Links today, and :

Code:
UPDATE Links
SET Add_Date =SUBDATE(CURDATE(), INTERVAL 90 DAY)
WHERE Add_Date=''

Will set all dates of 0000-00-00 (which is equivalent to NULL to 1999-06-15 (90 days before today).

Then,

Code:
UPDATE Links
SET Mod_Date =SUBDATE(CURDATE(), INTERVAL 90 DAY)
WHERE Mod_Date=''

WIll sent the modified date to the same date.

I'm sure you can combine them all, but I'm not familiar enough with SQL to do that.

Hope that gets rid of one of your nightmares...

Oh, I did this in PHPAdmin, and it did _NOT_ return the number of records modified, but it modified them anyway.


Quote Reply
Re: User Friendly Dates In reply to
In one query that would be:

UPDATE Links SET Add_Date = '1999-08-01', Mod_Date = '1999-08-01'

(I hardcoded the date in). Wink

I've been thinking about how to use other date formats. What I recommend is in HTML_Templates, you'll need to write a small subroutine that will take in a date in mysql format and return it in your format. Unfortunately you'll need to call this a number of times. I'll look at adding some date handling features.

Cheers,

Alex
Quote Reply
Re: User Friendly Dates In reply to
Alex --

The mix of your version and my version would be:

Code:
UPDATE Links
SET Add_Date = '1999-08-01', Mod_Date = '1999-08-01'
WHERE Add_Date=''

Without the 'where' clause, it will change every date, not just the missing ones.
Quote Reply
Re: User Friendly Dates In reply to
Hello Alex and Robert!

Youll answered to my nightmares before many weeks and I did not even know. Had I know about it I would have reacted and thanked.

The stories about the programmed nightmares continues to be discovered from Links SQL and MySQL.

Thats not the problem at all to fill in a date somewhere in one of the columns. I could setup as a default value and that should be no problem.

My problem is the date compatibility between the two great programs and export import between the two.

1.

I have date 01.01.99 in Access. As Alex suggested me to change it in text that solves the first part that 01.01.99 will NOT be exported as 01.01.99 00:00:00.

Further, I can control it with validate of defs as empty ' ', so all those dates will enter in the MySQL. But the problem is changing it to unix format. Without this it does not recognize it as a date at all.

So to give a SET FUNCTION does not help and is not a remedy to the problem. I have all the dates but in access format and now is the unix format problem.

I am writing anathor message as a new topic regarding the problem.