sysdfg
Posts: 14
|
| Posted: 03/28/2007, 12:12 PM |
|
Don't know what was up with my other thread, did not seem to be working correctly.
Okay,
I have a field in mySQL that is UNIX timestamp which is named otime. In my grid is the field otime, which by the way stands for open time.
All I want to do is output the timestamp to non geek like Mar 30, 2007.
I tried to enter several different functions, I don't think I am putting them in the correct location.
I've done this on standard asp pages, just can't figure out with codecharge.
|
 |
 |
Oper
Posts: 1195
|
| Posted: 03/28/2007, 12:30 PM |
|
Check the help there is ton of info for different display
otime as your field Source
Control Source: otime
Data Type: Date
Format: mmmm d, yyyy
you could play with any format.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
sysdfg
Posts: 14
|
| Posted: 03/28/2007, 12:32 PM |
|
Quote Oper:
Check the help there is ton of info for different display
otime as your field Source
Control Source: otime
Data Type: Date
Format: mmmm d, yyyy
you could play with any format.
I thought it was that easy, tried and nothing but a blank space shows up.
|
 |
 |
Oper
Posts: 1195
|
| Posted: 03/28/2007, 12:38 PM |
|
do you have somthing on the before show?
if not we will need difffernt aproach
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
sysdfg
Posts: 14
|
| Posted: 03/28/2007, 12:40 PM |
|
No, nothing currently on the before show.
|
 |
 |
Oper
Posts: 1195
|
| Posted: 03/28/2007, 12:49 PM |
|
1 question, if you display without any format just the date.
it show up?
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
sysdfg
Posts: 14
|
| Posted: 03/28/2007, 12:58 PM |
|
Changed the Data Type to just Date and no info shows.
The mysql is set as INT, and the info looks like (1080749977) & no I cannot change it, yes, I did and I had to pull the data from my backup, just in case you are wondering.
|
 |
 |
Oper
Posts: 1195
|
| Posted: 03/28/2007, 1:03 PM |
|
hummm, then is not a TIMESTAMP format its a INT format?
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
Oper
Posts: 1195
|
| Posted: 03/28/2007, 1:13 PM |
|
if you have a int value then you shoudl do this on your Select SQL
SELECT FROM_UNIXTIME(yourtimefieldindatabase) ...............
it worked for me just now
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
sysdfg
Posts: 14
|
| Posted: 03/28/2007, 1:16 PM |
|
Okay, I'm dumb, were do I need to plug this in?
|
 |
 |
Benjamin Krajmalnik
|
| Posted: 03/28/2007, 1:26 PM |
|
Function UnixTimeToDate(xUnixTime)
UnixTimeToDate = DateAdd("s", xUnixTime, "1/1/1970 00:00:00")
End Function
Place this near the bottom of your _events.asp page.
Set your label to be of date typr.
In the before show event:
EventCaller.Value = UnixTimeToDate(EventCaller.Value)
if that does not display properl (a possibility because the object may have
already tried to convert the data), set the data type as text, and use the
following code instead:
EventCaller.Value = CCFormatDate(UnixTimeToDate(EventCaller.Value),
array("mm","-","dd","-","yyyy"))
|
|
|
 |
sysdfg
Posts: 14
|
| Posted: 03/29/2007, 12:07 PM |
|
Thanks guys, the last one worked. I had the code before instead of after.
|
 |
 |
Chris__T
Posts: 339
|
| Posted: 04/03/2007, 12:49 PM |
|
How would you do the reverse? From standard date/time to unix time.
We have a search box that takes the regular date, and searches the mySQL database, which stores the date as a unix format.
|
 |
 |
|