I need a function that turns dd-mm-yyyy to yyyy-mm-dd
thanks
reversing date
Moderator: General Moderators
-
truepal20032001
- Forum Commoner
- Posts: 27
- Joined: Mon Jun 25, 2007 8:28 pm
if you find that in a regular string just do this
Code: Select all
$str = "dd-mm-yyyy";
if(strstr('dd-mm-yyyy ',$str){$str = "yyyy-mm-dd"; }truepal20032001 wrote:if you find that in a regular string just do this
Code: Select all
$str = "dd-mm-yyyy"; if(strstr('dd-mm-yyyy ',$str){$str = "yyyy-mm-dd"; }
This should go in hall of fametruepal20032001 wrote:if you find that in a regular string just do this
Code: Select all
$str = "dd-mm-yyyy"; if(strstr('dd-mm-yyyy ',$str){$str = "yyyy-mm-dd"; }
I'm sure explode() and then using dots works ( have not tried)
But this code is so strange to me. will that work?
But this code is so strange to me. will that work?
truepal20032001 wrote:if you find that in a regular string just do this
Code: Select all
$str = "dd-mm-yyyy"; if(strstr('dd-mm-yyyy ',$str){$str = "yyyy-mm-dd"; }
It takes less than minute to try out both stuff...don't be so lazym2babaey wrote:I'm sure explode() and then using dots works ( have not tried)
But this code is so strange to me. will that work?truepal20032001 wrote:if you find that in a regular string just do this
Code: Select all
$str = "dd-mm-yyyy"; if(strstr('dd-mm-yyyy ',$str){$str = "yyyy-mm-dd"; }