What would be really slick, is a way to attach a function to a particular field. This would allow to format any data any way the user wants.
In my example, I use a function called unUDate(unixtimestamp).
So, when the database contains something like "1252496133", I specify that the display should be unUDate(1252496133), and it comes out as "9/9/2009 11:35:33 AM". Or date(unUDate(1252496133)) would be "9/9/2009"
I also run into the same problem with updating records. Would be nice if it could go in reverse for updating. for example if I entered "9/9/2009", it would allow to pass through a function that would format it to "1252454400".
Here's the functions as I use them now:
Private Function UDate(strDate) UDate = DateDiff("s", "01/01/1970 00:00:00", strDate) End Function
Private Function unUDate(uDate) unUDate = DateAdd("s", uDate, "01/01/1970 00:00:00") End Function
|
|
|