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 ? 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. 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] 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
Archived
This topic is now archived and is closed to further replies.