Any one know why this would not work?
Using it in a DB Multi Record Loader.
All i get as a result is
01-01-1970
Info
MYSQL 5 Feild: cf_modified Type: datetime
I had this issue before but never got to the end of it . . . but need to now
<?php // convert date for user
echo date('d-m-Y',strtotime($row->cf_created));
?>
Using it in a DB Multi Record Loader.
All i get as a result is
01-01-1970
Info
MYSQL 5 Feild: cf_modified Type: datetime
I had this issue before but never got to the end of it . . . but need to now
Hi darrenhallinan ,
What value is in $row->cf_created ? Try this to see what is happening:
Bob
What value is in $row->cf_created ? Try this to see what is happening:
<?php // convert date for user
echo'<div>$row->cf_created: '.print_r($row->cf_created, true).'</div>';
echo'<div>strtotime($row->cf_created): '.print_r(strtotime($row->cf_created), true).'</div>';
echo date('d-m-Y',strtotime($row->cf_created));
?>
Bob
When I used the above code it resulted in :
$row->cf_created:
strtotime($row->cf_created):
01-01-1970
code must not be right, i change the ' to " around the echo statements thinking it might be that
but the just resulted in nothing been displayed
The value of the feild are date time format E.G: 2012-01-30 23:54:15 as set by chrono engine
$row->cf_created:
strtotime($row->cf_created):
01-01-1970
code must not be right, i change the ' to " around the echo statements thinking it might be that
<?php // convert date for user
echo "<div>$row->cf_created: '.print_r($row->cf_created, true).'</div>";
echo "<div>strtotime($row->cf_created): '.print_r(strtotime($row->cf_created), true).'</div>";
echo date('d-m-Y',strtotime($row->cf_created));
?>
but the just resulted in nothing been displayed
The value of the feild are date time format E.G: 2012-01-30 23:54:15 as set by chrono engine
I CAME ACROSS THIS
http://www.youtube.com/watch?v=3WQLHAwNPZY
Which work if i place this code in a custom code box:
and put in the date using
i get
Jun 09, 2011
But when I try
or
or
or
the result is again:
Jan 1, 1970
Any ideas?
http://www.youtube.com/watch?v=3WQLHAwNPZY
Which work if i place this code in a custom code box:
<?php
function convert ($date) {
$converteddate = date("M j, Y", strtotime ($date));
return $converteddate;
}
?>
and put in the date using
<?php
echo convert("2011-06-09 23:25:00");
?>
i get
Jun 09, 2011
But when I try
<?php
echo convert(".$detail ['cf_created'].");
?>
or
<?php echo convert ("$detail ['cf_created']"); ?>
or
<?php echo convert($row->cf_created); ?>
or
<?php echo convert("$row->cf_created"); ?>
the result is again:
Jan 1, 1970
Any ideas?
Hi darrenhallinan ,
It looks to me as though $row->cf_created is empty. Where are you getting this value from?
Bob
It looks to me as though $row->cf_created is empty. Where are you getting this value from?
Bob
Hi Bob
I know that's what it looks like but the fields do have values
anyway I have made some headway
this works. . .
Form type: Custom
HTML code:
Which surprised me to be honest - what a headache
anyway still have no solution for the multi record db using custom code
I know that's what it looks like but the fields do have values
anyway I have made some headway
this works. . .
Form type: Custom
HTML code:
<?php
function convert ($date) {
$converteddate = date("M j, Y", strtotime ($date));
return $converteddate;
}
?>
<?php
echo convert("{cf_created}");
?>
Which surprised me to be honest - what a headache
anyway still have no solution for the multi record db using custom code
Hi darrenhallinan,
Hmm - I wouldn't have expected that to work either !!
Up to my eyebrows here but clearing posts when I can.
Bob
Hmm - I wouldn't have expected that to work either !!
Up to my eyebrows here but clearing posts when I can.
Bob
Same as that bob I reckon ill have to leave it just having the date on the detail page for now. . it just taken so much time to get that to work.
it would be nice but not necessary to have it on the list of results
As always Bob thanks for you help
it would be nice but not necessary to have it on the list of results
As always Bob thanks for you help
OK just for those looking for same solution . . . and note to myself in the future if i ever return to it!!
This might work. . . not tested but just thought of it while replying to bobs post. .
Use the code that works above in the custom html box (not using the wizard)
and instead of adding your code using the custom code box in the on records found on multi db loader just add the "show html" to the on record found
This might work. . . not tested but just thought of it while replying to bobs post. .
Use the code that works above in the custom html box (not using the wizard)
and instead of adding your code using the custom code box in the on records found on multi db loader just add the "show html" to the on record found
This topic is locked and no more replies can be posted.