//时间格式化 date时间 style样式
//type == 1: 根据时区改变
//type == 2: 固定样式
- (NSString *)formatterDatestyle:(NSString *)style type:(NSInteger)type
{
if(type ==
1)
[[NSDate getOutputFormatter]
setDateFormat:[NSDateFormatter dateFormatFromTemplate:style
options:0 locale:[NSLocale currentLocale]]];
else if(type
== 2)
[[NSDate getOutputFormatter]
setDateFormat:style];
return
[[NSDate getOutputFormatter] stringFromDate:self];
}
-(NSString*)getDateFormateWithDateSh ow:(BOOL)dateShow
withTimeShow:(BOOL)timeShow
{
if
(dateShow==YES) {
[[NSDate getOutputFormatter]
setDateStyle:NSDateFormatterMediumSty le];
}
if
(timeShow==YES) {
[[NSDate getOutputFormatter]
setTimeStyle:NSDateFormatterShortStyl e];
}
NSString*
time = [outputFormatter stringFromDate:self];
//[outputFormatter release];
return
time;
}
//字符串转日期
+(NSDate*)formatterDate:(NSString *)style withDate:(NSString*)dateStr
{
// if(type ==
1)
//
[[NSDate getOutputFormatter]
setDateFormat:[NSDateFormatter dateFormatFromTemplate:style
options:0 locale:[NSLocale currentLocale]]];
// else
if(type == 2)
[[NSDate
getOutputFormatter] setDateFormat:style];
return
[[NSDate getOutputFormatter] dateFromString:dateStr];
}
+ (NSDate * )NSStringToNSDate: (NSString * )dateStr withFormat:(NSString*)format
{
NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter
setDateFormat: format];
NSDate *date
= [formatter dateFromString :string];
[formatter
release];
return
date;
}
+(NSDateFormatter*)getOutputFormatter
{
if
(outputFormatter==nil) {
outputFormatter = [[NSDateFormatter alloc] init];
}
return
outputFormatter;
}
//type == 1: 根据时区改变
//type == 2: 固定样式
- (NSString *)formatterDatestyle:(NSString *)style type:(NSInteger)type
{
}
-(NSString*)getDateFormateWithDateSh
{
}
//字符串转日期
+(NSDate*)formatterDate:(NSString *)style withDate:(NSString*)dateStr
{
//
//
//
}
+ (NSDate * )NSStringToNSDate: (NSString * )dateStr withFormat:(NSString*)format
{
}
+(NSDateFormatter*)getOutputFormatter
{
}