Gena
Posts: 591
|
Posted: 07/09/2012, 9:44 AM |
|
I am working with some "external" database and one of the table has a fields that stores date/time but in some strange format.
so that fields defined as
start bigint(20) unsigned (NULL)
end bigint(20) unsigned (NULL)
now it has value, for example, like these:
1341093600 eq 01/07/12 00:00:00 (so it is 1, July, 2012)
1341179940 eq 01/07/12 23:59:59
So my question is:
1. what is that type of date/time field???
2. how do I work with it in CCS?? especially using PHP.
p.s. it seems that original database managment system is written in YII framework. If it can helps.
_________________
Gena |
|
|
DataDoIT
|
Posted: 07/10/2012, 4:43 AM |
|
That's a Julian day count. See http://en.wikipedia.org/wiki/Julian_day.
To convert to something you'll understand in PHP, see http://www.php.net/manual/en/function.cal-from-jd.php.
Once you convert it into an array from above, then you can use CCS's
CCParseDate() and CCFormatDate() functions to work with it.
|
|
|
MichaelMcDonald
Posts: 640
|
Posted: 07/10/2012, 4:58 AM |
|
Unix time ?
_________________
Central Coast, NSW, Australia.
|
|
|
Gena
Posts: 591
|
Posted: 07/10/2012, 5:41 AM |
|
it seems to be an UNIX_TIMESTAMP
so code like date('d.m.Y H:i:s', 1341179940); gives me
01.07.2012 23:59:00
_________________
Gena |
|
|
Gena
Posts: 591
|
Posted: 07/10/2012, 5:43 AM |
|
so the question is how do I work with it in CCS?? I mean Grid, Record ecc support
_________________
Gena |
|
|
DataDoIT
|
Posted: 07/10/2012, 5:48 AM |
|
You are correct. More info: http://en.wikipedia.org/wiki/Unix_time
|
|
|
DataDoIT
|
Posted: 07/10/2012, 6:20 AM |
|
For a label control, grab the field's value as normal, keeping it as an
Integer. Then, for the BeforeShow of the label, add a 'Retrieve Value
for Control' action and set as follows:
Control Name:
Source Type: Expression
Source Name: CCFormatDate(CCParseDate(date('Y-m-d H:i:s',
$Component->GetValue()), array("yyyy", "-", "mm", "-", "dd", " ", "HH",
":", "nn", ":", "ss")), array("GeneralDate"))
Adjust that final array("GeneralDate") to any format you want to
display, per http://wiki.codechargesupport.com/index.php/Programming...ns:CCFormatDate.
|
|
|
Gena
Posts: 591
|
Posted: 07/10/2012, 6:32 AM |
|
thanks, DataDoIT. good point to start!
_________________
Gena |
|
|
bannedone
Posts: 273
|
Posted: 07/10/2012, 1:56 PM |
|
http://forums.yessoftware.com/posts.php?post_id=97052
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2 |
|
|
|