Home Tutorial Iphone Examples Nslog NSLog Date example code

 
 

Share on Google+Share on Google+
NSLog Date example code
Posted on: July 29, 2009 at 12:00 AM
Advertisement
In this example code I will show you how you can print the current date using the NSLog function.

In this following code we have create a variable to of NSDate class and then used the NSLog function to print the date on the console.

//
//  hellodate.h
//  DataTypes
//
// 

#import <Foundation/Foundation.h>  

@interface hellodate : NSObject {

    @public

    NSDate *today;

}

-(void) print; 

@end

The implementation class of hellodate is as follows:

//
//  hellodate.m
//  DataTypes
//
//

#import "hellodate.h"

@implementation hellodate

-(void) print{

    today= [NSDate date];

    NSLog(@"the current date is %@",today);

}

@end

 

Advertisement

Related Tags for NSLog Date example code:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 29, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com