Jump to content
php.lv forumi

Recommended Posts

Posted

Tātad pašlaik man date tiek izsaukts šādi:

 

$seen = date("d", $row["lastvisit"]);
 $datums = date("d");
 if($datums - $seen == 1)
 {
 $redzets = '<b>vakar '.date("H:i", $row["lastvisit"]).'</b>';
 }
 elseif($datums - $seen == 0)
 {
 $redzets = '<b>šodien '.date("H:i", $row["lastvisit"]).'</b>';
 }
 else
 {
 $redzets = '<b>'.date("j. F H:i", $row["lastvisit"]).'</b>';
 }

 

bet kā izdarīt lai January vietā būtu rakstīts janvārī?

man jātaisa masīvs ar katra mēneša latvisko un anglisko vērtību un jāaizvieto vai date f-jā ir iekļauti risinājumi citām valstīm?

Posted (edited)

kaut kā nebūt izdomāju :)

 

$seen = date("d", $row["lastvisit"]);
 $datums = date("d");
 if($datums - $seen == 1)
 {
 $redzets = '<b>vakar '.date("H:i", $row["lastvisit"]).'</b>';
 }
 elseif($datums - $seen == 0)
 {
 $redzets = '<b>šodien '.date("H:i", $row["lastvisit"]).'</b>';
 }
 else
 {
 $masivs = array(
 "janvārī" => "January", 
 "februārī" => "February", 
 "martā" => "March",
 "aprīlī" => "April",
 "maijā" => "May",
 "jūnijā" => "June",
 "jūlijā" => "July",
 "augustā" => "August",
 "septembrī" => "September",
 "oktobrī" => "October",
 "novembrī" => "November",
 "decembrī" => "December"
 );

 $tagad = date("F", $row["lastvisit"]);
 $menesis = array_search($tagad, $masivs);
 $redzets = '<b>'.date("j.", $row["lastvisit"]).' '.$menesis.' '.date("H:i", $row["lastvisit"]).'</b>';
 }

Edited by eT`

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...