Tag Archives: time

124 views

PHP get daylight saving time

$dst = date("I"); //I (capital i); 0 or 1 if daylight saving time   // example: $hour = 14; if(date("I")===1){ $hour = $hour + 1; } // OR $hour = 14 + date("I");

Posted in PHP | Tagged | Comments Off on PHP get daylight saving time
4,127 views

Date getDate is deprecated Java Android

Date getDate is deprecated Java Android example code:   long dayInMili = 100000000;   GregorianCalendar calToDay = new GregorianCalendar(); int nD = calToDay.get((Calendar.MILLISECOND)); // +dayInMili; System.out.println(nD);   long lTime = calToDay.getTimeInMillis(); System.out.println(lTime);   Date dtA = new Date(lTime); // today … Continue reading

Posted in Android Examples Code | Tagged , , | Comments Off on Date getDate is deprecated Java Android
51,479 views

Timer task TimerTask run cancel Android example

Update TextView from TimerTask, Handler, schedule, run, cancel TimerTask, Android example public class TimerActivity extends Activity { TimerTask mTimerTask; final Handler handler = new Handler(); Timer t = new Timer(); TextView hTextView; TableRow hTableRow; Button hButton, hButtonStop;     private … Continue reading

Posted in Android Examples Code | Tagged , , , , , | Comments Off on Timer task TimerTask run cancel Android example
11,177 views

How are you old – date calendar age Java Android example

Calendar dateOfYourBirth = new GregorianCalendar(1998, Calendar.SEPTEMBER, 17); Calendar today = Calendar.getInstance(); Android example. public class HoriziontalScrollActivity extends Activity { TextView txtV; Context cntx;   @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); txtV = (TextView)findViewById(R.id.idLabel); cntx = this; StringBuilder strBuild … Continue reading

Posted in Android Examples Code | Tagged , , , , | Comments Off on How are you old – date calendar age Java Android example
4,464 views

Leap year date time Java Android example

GregorianCalendar cal = new GregorianCalendar(); Boolean b = cal.isLeapYear(2012); // true, Android example. public class MainActivity extends Activity { TextView txtV; Context cntx;   @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); txtV = (TextView)findViewById(R.id.idLabel); cntx = this; StringBuilder strBuild … Continue reading

Posted in Android Examples Code | Tagged , , , , | Comments Off on Leap year date time Java Android example
5,475 views

Date time difference determine which is earlier Android Java example

Date difference in millisecond between two date, GregorianCalendar, Calendar, after(), befor(), getTimeInMillis().   public class HoriziontalScrollActivity extends Activity { TextView txtV; Context cntx;   @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); txtV = (TextView)findViewById(R.id.idLabel); cntx = this; StringBuilder strBuild … Continue reading

Posted in Android Examples Code | Tagged , , , , | Comments Off on Date time difference determine which is earlier Android Java example
8,991 views

Timer stopwatch based on Java Calendar class Android example

Start Stop Stopwatch Timer Android example source code. private static long mStartTime = 0L; Calendar cal; TextView hTextViewVypis = (TextView)findViewById(R.id.idTextVypis);   void start(){ cal = Calendar.getInstance(); mStartTime = cal.getTimeInMillis(); }   void stop(){ prinOutStopWatchTime(); }     private void prinOutStopWatchTime() … Continue reading

Posted in Android Examples Code | Tagged , , , , , | Comments Off on Timer stopwatch based on Java Calendar class Android example