Friday, August 19, 2011

How to get date time and device id from BlackBerry device programatically Java

These are very basic things in mobile development. but its very useful to keep them documented.First we will see how to get date time
public static String  getCurrentDateTime()
    {
    SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aaa");
    return dateFormat.format(new Date(System.currentTimeMillis()));

    }

Then we will see how to get device id from device 
net.rim.device.api.system.DeviceInfo.getDeviceId()

No comments:

Post a Comment