sun14php Posted June 26, 2006 Share Posted June 26, 2006 Q1.how do i display mysql yyyy-mm-dd date into browse as dd-mm-yy format using php or whatever ?Q2. can set input-mask in html's textbox to accept date as dd-mm-yy ? Quote Link to comment https://forums.phpfreaks.com/topic/12912-yyyy-mm-dd-to-dd-mm-yy/ Share on other sites More sharing options...
hackerkts Posted June 26, 2006 Share Posted June 26, 2006 I'm not very sure what you mean, but this is the date format you wants.[code]date(d-m-y);[/code]Please refer to [a href=\"http://sg.php.net/date\" target=\"_blank\"]http://sg.php.net/date[/a] for more informations. Quote Link to comment https://forums.phpfreaks.com/topic/12912-yyyy-mm-dd-to-dd-mm-yy/#findComment-49572 Share on other sites More sharing options...
Orio Posted June 26, 2006 Share Posted June 26, 2006 You can use explode()...[code]<?php//$date is in yyyy-mm-dd format$explode=explode("-",$date);$new_date=$explode[2]."-".$explode[1]."-".$explode[0];echo $new_date;?>[/code]Orio.EDIT-And if you want to convet yyyy to yy, do this:[code]<?php//$date is in yyyy-mm-dd format$explode=explode("-",$date);$explode[0]=substr($explode[0], -1, 2);$new_date=$explode[2]."-".$explode[1]."-".$explode[0];echo $new_date;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12912-yyyy-mm-dd-to-dd-mm-yy/#findComment-49593 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.