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

(새 문서: 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...)
 
6번째 줄: 6번째 줄:
;first_of_month
;first_of_month
*test set
*test set
:2011-11-11 → 2011-11-01
:first_day("2011-11-11") "2011-11-01"


==Bash==
==Bash==

2014년 11월 20일 (목) 11:26 판


1 개요

FIRST_DAY
first day of month
first_of_month
  • test set
first_day("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 }}