Barand Posted August 24, 2012 Share Posted August 24, 2012 In my defence, he was looking for something that could be eval()'d Quote Link to comment https://forums.phpfreaks.com/topic/267498-convert-ddmmyyyy-to-yyyymmdd/page/2/#findComment-1371983 Share on other sites More sharing options...
PFMaBiSmAd Posted August 24, 2012 Share Posted August 24, 2012 The DOC for that 'parser' indicates it just wants an expression that produces an assignable value. The code probably does use eval internally to accomplish that, but that is not directly an issue. The OP is apparently testing using eval, but since the {item.xxx} is the parser's syntax to indicate data values and is not valid php, directly using eval should produce an error. I'm going to guess the following might work - {{date('Y-m-d H:i:s', strtotime(str_replace('/','-',{item.StartDate})))}} Quote Link to comment https://forums.phpfreaks.com/topic/267498-convert-ddmmyyyy-to-yyyymmdd/page/2/#findComment-1371987 Share on other sites More sharing options...
mikemeadeuk Posted August 24, 2012 Author Share Posted August 24, 2012 The DOC for that 'parser' indicates it just wants an expression that produces an assignable value. The code probably does use eval internally to accomplish that, but that is not directly an issue. The OP is apparently testing using eval, but since the {item.xxx} is the parser's syntax to indicate data values and is not valid php, directly using eval should produce an error. I'm going to guess the following might work - {{date('Y-m-d H:i:s', strtotime(str_replace('/','-',{item.StartDate})))}} Works perfectly!! Thanks PFM, and everyone else for your help! :-) Quote Link to comment https://forums.phpfreaks.com/topic/267498-convert-ddmmyyyy-to-yyyymmdd/page/2/#findComment-1371988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.