2017-11-06 3 views
0

내 프로젝트에 FSCalendar를 사용하고 있습니다. 내가 calendar.It에서 어떤 날짜를 클릭하면 console.How에서 이전 날짜를 표시합니다.이 문제를 해결할 수 있습니까? 제발 도와주세요. 예를 들어 2017-11-28 날짜를 클릭하면 선택한 날짜가 표시됩니다. : 2017-11-27 18 : 30 : 00 0000캘린더 스위프트에서 시간 형식을 변경하는 방법 3

+0

당신이 CurrentLocale에 날짜 로케일을 변경, DateFormatter를 사용한다고 생각을, 그것은 당신의 문제를 해결할 수 있습니다. –

+0

어떤 형식으로 값 – Ram

+0

이 필요합니까? 2017-11-28에 있습니까? – Ram

답변

1

가 FSCalendar의 deleget을 설정하고이 코드를 시도 :

func calendar(_ calendar: FSCalendar, shouldSelect date: Date, at monthPosition: FSCalendarMonthPosition) -> Bool { 
    let dateFormatter = DateFormatter() 
    dateFormatter.dateFormat = "dd-MM-yyyy" 
    let dateString = dateFormatter.string(from: date as Date) 
    print("Selected Date: \(dateString)") 
    return true 
} 
관련 문제