반응형
250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- redis
- Spring Error
- Flux
- bootstrap
- codebuild
- SQL
- node
- or some instances in your deployment group are experiencing problems.
- aws cicd
- codedeploy error
- chart.js
- kubeflow
- AWS CI/CD 구축하기
- aws
- codedeploy
- JavaScript
- java bigdecimal
- docker
- codepipeline
- chartjs
- IntelliJ
- Jenkins
- Spring
- Python
- 도커
- PostgreSQL
- COALESCE
- Airflow
- VPN
- Kafka
Archives
- Today
- Total
Small Asteroid Blog
[javascript] 현재 날짜 시간 구하기 date format ( yyyy-MM-dd, yyyy-MM-dd hh:mm:ss ) 본문
프론트엔드/Javascript
[javascript] 현재 날짜 시간 구하기 date format ( yyyy-MM-dd, yyyy-MM-dd hh:mm:ss )
작은소행성☄️ 2021. 9. 9. 14:08728x90
//yyyy-MM-dd
function convertDate(datetime){
var date = new Date(datetime);
var year = date.getFullYear();
var month = date.getMonth()+1;
month = month >= 10 ? month : '0' + month;
var day = date.getDate();
day = day >= 10 ? day : '0' + day;
return [year,month,day].join('-');
}
//yyyy-MM-dd HH:mm:ss
function convertDateTime(datetime){
var date = new Date(datetime);
var year = date.getFullYear();
var month = date.getMonth()+1;
month = month >= 10 ? month : '0' + month;
var day = date.getDate();
day = day >= 10 ? day : '0' + day;
var hour = date.getHours();
hour = hour < 10 ? '0' + hour.toString() : hour.toString();
var minites = date.getMinutes();
minites = minites < 10 ? '0' + minites.toString() : minites.toString();
var seconds = date.getSeconds();
seconds = seconds < 10 ? '0' + seconds.toString() : seconds.toString();
return [year,month,day].join('-') +" "+ hour+":"+minites+":"+seconds;
}
728x90
반응형
'프론트엔드 > Javascript' 카테고리의 다른 글
dataTable 데이터 변경시 테이블 다시 그리기 (0) | 2021.09.28 |
---|---|
[Javascript] 하루전, 한달전, 일년전으로 날짜 세팅하기 (0) | 2021.09.09 |
ajax 사용 후 이벤트 작동하지 않을 때 (0) | 2021.09.06 |
[jquery] checkbox 체크여부 확인하기 (0) | 2021.08.25 |
[javascript] json, array,Object - for each 문으로 값 확인 (0) | 2021.08.25 |