반응형 date format2 [Python] 현재 날짜 포멧 출력하기 from datetime import datetime format_data = "%Y-%m-%d %H:%M:%S.%f" now_str = datetime.now().strftime(format_data) print(now_str) # 2022-08-22 19:11:38.565332 포멧 종류는 아래와 같습니다. format code meaning example %a Abbreviated weekday name Sun, Mon %A Full weekday name Sunday, Monday %w Weekday as decimal number 0…6 %d Day of the month as a zero-padded decimal 01, 02 %-d day of the month as decimal numbe.. 2022. 8. 22. [IOS] [Objective-C] Date Formatting, 날짜포멧 Objective-C Date Format Formatter 정하기 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss:SSS"]; 현재 시간 가져오기 NSDate *currentDate = [NSDate date]; 현재 시간을 정해진 format 으로 변환 NSString *dateString = [formatter stringFromDate:currentDate]; NSLog(@"%@", dateString); // 2022-02-06 21:14:38:509 2022. 2. 8. 이전 1 다음 728x90 반응형