FIRST DAY

Jmnote (토론 | 기여)님의 2014년 11월 20일 (목) 01:49 판 (새 문서: category: Date ==개요== ;FIRST_DAY ;first day of month ;first_of_month *test set :2011-11-11 → 2011-11-01 ==Bash== category: Bash <source lang='bash'> INPUT=2011-11-11 O...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)


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