Application Testing: An Integral Part of DevOps

Date: 4/7/208 @ p.m. ET

You may want to know if your supports programmatically. This can be easily determined with the code below:

Listing 1. Sample Code

import java.util.TimeZone;

public class DaylightSavingsTime
{
   
   public static void (String args[])
   {
      DaylightSavingsTime daylightSavingsTime = new DaylightSavingsTime();
      daylightSavingsTime.proceed();
   }
   
   private void proceed()
   {
      TimeZone tz = TimeZone.getDefault();
      //Uncomment the below line to use the timezone of your choice. Repalce "America/Los_Angeles" with your timezone id.
      //TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
      //This returns the ID of the time zone used
      .out.println("tz.getID(): " + tz.getID());
      //The display name of the ID
      .out.println("tz.getDisplayName(): " + tz.getDisplayName());
      //This returns true if the time zone uses Daylight Savings Time
      .out.println("tz.getDSTSavings(): " + tz.getDSTSavings());
      //This returns true if the time zone is currently using Daylight Savings Time
      .out.println("tz.useDaylightTime(): " + tz.useDaylightTime());
   }
}

 

Visit the DevX Tip Bank

 



Source link
thanks you RSS link
( http://www.devx.com/DevX/tip-does-your-timezone--daylight-saving-time.html)

LEAVE A REPLY

Please enter your comment!
Please enter your name here