"FIRST DAY"의 두 판 사이의 차이

1번째 줄: 1번째 줄:
[[category: Date]]
[[category: 날짜]]


==개요==
==개요==

2020년 3월 5일 (목) 01:23 판


1 개요

FIRST_DAY
first day of month
first_of_month
  • test set
"2011-11-11" → "2011-11-01"

2 Bash

INPUT=2011-11-11
OUTPUT="${INPUT:0:7}-01"
echo $OUTPUT

3 PHP

function first_of_month($day) {
  return substr($day, 0, 7).'-01';
}

4 SQL

4.1 MySQL

SELECT CONCAT(SUBSTR("2011-11-11",1,8),"01");
-- 2011-11-01

5 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}