Welcome Guest, Not a member yet? Register   Sign In
Dateformat convert
#3

[eluser]mehike[/eluser]
this is not answer to question...

right now I'm some answer to.

our country is date format - dd.mm.yyyy
but in database I must save this another way.

I use helper right now for this and this is workiing but it's not good way for this, I know...

if ( ! function_exists('date_to_db')) {
function date_to_db($dat) {
$dat_arr = date_parse($dat);
return $dat_arr['year'].'-'.$dat_arr['month'].'-'.$dat_arr['day'];
}
}

if ( ! function_exists('date_from_db')) {
function date_from_db($dat) {
$dat_arr = date_parse($dat);
if (strlen($dat_arr['month'])==1)
$dat_arr['month'] = '0'.$dat_arr['month'];
if (strlen($dat_arr['day'])==1)
$dat_arr['dat'] = '0'.$dat_arr['day'];
return $dat_arr['day'].'.'.$dat_arr['month'].'.'.$dat_arr['year'];
}
}


I't must be better way....
but I'm not time to search it.


Messages In This Thread
Dateformat convert - by El Forum - 01-17-2010, 06:52 AM
Dateformat convert - by El Forum - 01-17-2010, 07:40 AM
Dateformat convert - by El Forum - 01-17-2010, 01:55 PM
Dateformat convert - by El Forum - 01-17-2010, 02:20 PM
Dateformat convert - by El Forum - 01-18-2010, 12:10 AM
Dateformat convert - by El Forum - 01-18-2010, 08:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB