Skip to content

Commit

Permalink
FIX apply timezone manually
Browse files Browse the repository at this point in the history
  • Loading branch information
pjshwa committed Mar 2, 2024
1 parent 02c482d commit 2e07779
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 5 additions & 7 deletions aeogae_queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
$r = $conn->query($sql);
echo "<ul>";
if ($r->num_rows > 0) {
// output data of each row

while($row = $r->fetch_assoc()) {
$reg_date = DateTime::createFromFormat('Y-m-d H:i:s', $row["reg_date"], new DateTimeZone('UTC'));
$reg_date->setTimezone(new DateTimeZone('Asia/Seoul'));
echo "<li>".$row["a_query"]." (".$reg_date->format('Y-m-d H:i:s').")</li>";
}
while ($row = $r->fetch_assoc()) {
$date = new DateTime($row["reg_date"], new DateTimeZone('UTC'));
$date->setTimezone(new DateTimeZone('Asia/Seoul'));
echo "<li>".$row["a_query"]." (".$date->format('Y-m-d H:i:s').")</li>";
}
} else {
echo "검색 결과가 없다";
}
Expand Down
3 changes: 2 additions & 1 deletion eggs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
}
else {
foreach ($articles as $article) {
$date = new DateTime($article['date']);
$date = new DateTime($article['date'], new DateTimeZone('UTC'));
$date->setTimezone(new DateTimeZone('Asia/Seoul'));
$datestr = $date->format('Y년 n월 j일 H시 i분');

echo '<article id="article_'.$article['id'].'">';
Expand Down

0 comments on commit 2e07779

Please sign in to comment.