Jump to content
php.lv forumi

paliidziet saprast


Recommended Posts

Ir funkcija kas ņem datus no DB kas glabājas datetime formātā un mēnesi pārveido latvuski, taču visu laiku izdod janvāri.

cik saprotu kļūda ir date funkcijā, pie $asd, angliski menesi no DB ņem pareizi.

 

 

$asd=$myrow['dtime'];

 

$z=date("n",$asd); $myarray=array("Janvāris","Februāris","Marts","Aprīlis","Maijs","Jūnijs","Jūlijs","Augusts","Septembrs","Oktobris","Novembris","Decembris");

$i=0;

while($i <count($myarray)){

if($z==$i+1){

$z=$myarray[$i];

echo $z;

}

$i++;

}

Link to post
Share on other sites
$months=array(
1=>"Javāris",
2=>"Februāris",
3=>"Marts",
4=>"Aprīlis",
5=>"Maijs",
6=>"Jūnijs",
7=>"Jūlijs",
8=>"Augusts",
9=>"Septembris",
10=>"Oktobris",
11=>"Novembris",
12=>"Decembris",
);
echo $months[(int)date("n",strtotime($myrow['dtime']))];

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...