This topic is locked

Date Related Problem(urgent)

3/26/2007 9:03:59 AM
PHPRunner General questions
M
mahavir_singh author

hi all, I am new to this forum and have some problem related to date.
Here is my problem
I have taken date as type int in my mysql database table, now I am getting date in unix timestamp like this Submission Date 1166887648.
Now I want to format this date according to my settings and i have modified the date as
*$date = gmdate("l F d Y h:i", ($row['date'] + 5.53600));**
But I don't know where should i make changes(which files) so that i can format the date.
To be Brief:
I want that date should be show as 26 march 2007 10:30am instead of 1166887648(which is stored in mysql database).
Waiting for reply.

J
Jane 3/26/2007

Hi,
to display date field in another format proceed to the Visual Editor tab, select List page, double click on the field, select Custom on the "View as" settings dialog and add your code:

$value = gmdate("l F d Y h:i", ($value + 5.5*3600));

M
mahavir_singh author 3/26/2007

Thakx very much <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16513&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
Now I have a little bit problem...acutally i compiled another code and somehow managed to see the file where the values have changed....So I go this..in commonfunctions.php, line 298
// return custom expression

function CustomExpression($data,$field,$table="")

{

global $strTableName;

if(!$table)

$table=$strTableName;

$value=$data[$field];

if($table=="mytalbe" && $field=="date")

{

$value = gmdate("l F d Y h:i", ($value+ 5.5*3600));

}

return $value;
}
Now I have similar kind of application and have compiled that one earlier, so I just changed these values in that application's commonfunctions.php file but still I can't able to view the time in above format..
Can you please tell me where should I make changes so as to get the desired date output without going to the visual editor..

J
Jane 3/27/2007

Hi,
open generated ..._list.php file, find following code snippet:

// FieldName - Custom

$value="";

$value = ProcessLargeText(GetData($data,"FieldName", "Short Date"),"field=FieldName".$keylink,"",MODE_LIST);

$row[$col."FieldName_value"]=$value;



and replace it with this one:

// FieldName - Custom

$value="";

$value = GetData($data,"FieldName", "Custom");

$row[$col."FieldName_value"]=$value;

M
mahavir_singh author 3/27/2007

yes....perfect...thkx buddy.... <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16534&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
Can you please tell me about this error which I am getting when i upload it to server
Error type 256

Error description Smarty error: unable to write to $compile_dir '/home/test/public_html/demo/templates_c'. Be sure $compile_dir is writable by the web server user.

J
Jane 3/27/2007

It's a permission error.

You need to make sure "templates_c" directory is writable by the web server user.

Usually you can assign correct permissions using your control panel. Also you may ask your webshoting company to help you with this.

M
mahavir_singh author 3/28/2007

Thanks very much buddy.... <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16560&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />