List of usage examples for org.joda.time DateTime getSecondOfDay
public int getSecondOfDay()
From source file:ch.emad.business.schuetu.zeit.Countdown.java
License:Apache License
public Countdown(final DateTime jetzt, final DateTime bis) { super();/*from ww w .j a v a 2 s . c o m*/ this.dauer = bis.getSecondOfDay() - jetzt.getSecondOfDay(); this.ablauf = bis; this.letzte = jetzt; this.sekundenToGo = this.dauer; }
From source file:com.foundationdb.sql.server.ServerValueEncoder.java
License:Open Source License
public static int timeSecsNoTZ(long millis) { DateTime dt = new DateTime(millis); return dt.getSecondOfDay(); }
From source file:com.kopysoft.chronos.activities.Editors.NewPunchActivity.java
License:Open Source License
private void updateDatabase() { int hour, min; TimePicker inTime = (TimePicker) findViewById(R.id.TimePicker1); Spinner taskSpinnerIn = (Spinner) findViewById(R.id.taskSpinnerIn); inTime.clearFocus();/* w w w . j a v a 2 s . c o m*/ hour = inTime.getCurrentHour(); min = inTime.getCurrentMinute(); Task inTask = tasks.get(taskSpinnerIn.getSelectedItemPosition()); DateTime date1 = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), hour, min); Chronos chrono = new Chronos(this); Job thisJob = null; List<Job> jobs = chrono.getAllJobs(); for (Job job : jobs) { if (job.getID() == jobID) thisJob = job; } DateTime startOfPP = thisJob.getStartOfPayPeriod(); if (startOfPP.getSecondOfDay() > date1.getSecondOfDay()) { date1 = date1.plusDays(1); Log.d(TAG, "Pay Period start " + startOfPP); Log.d(TAG, "insert date " + date1); Log.d(TAG, "Start Second of Day: " + startOfPP.getSecondOfDay()); Log.d(TAG, "This Second of Day: " + date1.getSecondOfDay()); } Punch newPunch = new Punch(thisJob, inTask, date1); if (enableLog) Log.d(TAG, "Date Time: " + newPunch.getTime().getMillis()); Log.d(TAG, "Date Time: " + newPunch.getTime()); chrono.insertPunch(newPunch); chrono.close(); //int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour }
From source file:com.kopysoft.chronos.activities.Editors.PairEditorActivity.java
License:Open Source License
private void updateDatabase() { int hour, min; TimePicker inTime = (TimePicker) findViewById(R.id.TimePicker1); Spinner taskSpinnerIn = (Spinner) findViewById(R.id.taskSpinnerIn); inTime.clearFocus();/*from w w w .j a va 2s . co m*/ hour = inTime.getCurrentHour(); min = inTime.getCurrentMinute(); Task inTask = tasks.get(taskSpinnerIn.getSelectedItemPosition()); DateTime date1 = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), hour, min); Chronos chrono = new Chronos(this); Job thisJob = chrono.getAllJobs().get(0); DateTime startOfPP = thisJob.getStartOfPayPeriod(); if (startOfPP.getSecondOfDay() > date1.getSecondOfDay()) { date1 = date1.plusDays(1); Log.d(TAG, "Moved Date1 foward one day"); } Log.d(TAG, "Date1: " + date1); p1.setTime(date1); p1.setTask(inTask); chrono.updatePunch(p1); //int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour if (p2 != null) { TimePicker outTime = (TimePicker) findViewById(R.id.TimePicker2); Spinner taskSpinnerOut = (Spinner) findViewById(R.id.taskSpinnerOut); outTime.clearFocus(); hour = outTime.getCurrentHour(); min = outTime.getCurrentMinute(); Task outTask = tasks.get(taskSpinnerOut.getSelectedItemPosition()); DateTime date2 = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), hour, min); if (startOfPP.getSecondOfDay() > date2.getSecondOfDay()) { date2 = date2.plusDays(1); Log.d(TAG, "Moved Date2 foward one day"); } Log.d(TAG, "Date2: " + date2); p2.setTime(date2); p2.setTask(outTask); chrono.updatePunch(p2); } chrono.close(); }
From source file:com.kopysoft.chronos.activities.QuickBreakActivity.java
License:Open Source License
private void updateDatabase() { int hour, min; TimePicker inTime = (TimePicker) findViewById(R.id.timePicker); Spinner timeSpinner = (Spinner) findViewById(R.id.timeSpinner); Spinner taskSpinner = (Spinner) findViewById(R.id.spinner); inTime.clearFocus();// ww w . ja v a 2 s. c o m hour = inTime.getCurrentHour(); min = inTime.getCurrentMinute(); Task inTask = tasks.get(taskSpinner.getSelectedItemPosition()); DateTime date1 = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), hour, min); Chronos chrono = new Chronos(this); Job thisJob = chrono.getAllJobs().get(0); DateTime startOfPP = thisJob.getStartOfPayPeriod(); if (startOfPP.getSecondOfDay() > date1.getSecondOfDay()) { date1 = date1.plusDays(1); } Punch startPunch = new Punch(thisJob, inTask, date1); DateTime endDate; switch (timeSpinner.getSelectedItemPosition()) { case (0): endDate = date1.plusMinutes(5); break; case (1): endDate = date1.plusMinutes(10); break; case (2): endDate = date1.plusMinutes(15); break; case (3): endDate = date1.plusMinutes(30); break; case (4): endDate = date1.plusMinutes(45); break; case (5): endDate = date1.plusMinutes(60); break; default: endDate = date1.plusMinutes(1); } Punch endPunch = new Punch(thisJob, inTask, endDate); if (enableLog) Log.d(TAG, "Date Time: " + startPunch.getTime().getMillis()); Log.d(TAG, "Start Punch" + startPunch.getTime()); Log.d(TAG, "End Punch" + endPunch.getTime()); chrono.insertPunch(startPunch); chrono.insertPunch(endPunch); chrono.close(); //int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour }
From source file:com.tkmtwo.sarapi.support.ValueUtil.java
License:Apache License
public static Time toTime(DateTime dt) { if (dt == null) { return null; }// w w w. j a v a 2 s .co m return new Time(dt.getSecondOfDay()); }
From source file:course_generator.trackdata_table.HourRenderer.java
License:Open Source License
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); TrackData track = (TrackData) value; DateTime time = track.data.get(row).getHour(); //-- Set the value setText(time.toString("E HH:mm:ss ")); setHorizontalAlignment(RIGHT);/*from w w w .j a va 2 s.c om*/ //-- Set the background color Color c = new Color(221, 255, 155); //Color.LightGreen; int ts_val = time.getSecondOfDay(); int ts_start = track.StartNightTime.getSecondOfDay(); int ts_end = track.EndNightTime.getSecondOfDay(); if ((track.bNightCoeff) && ((ts_val > ts_start) || (ts_val < ts_end))) c = new Color(0, 128, 255);//95,158,160); //CadetBlue; if (isSelected) setBackground(new Color(51, 153, 255)); else setBackground(c); return this; }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** * ? ?? true false ./*from w ww .jav a 2s . c om*/ * * @param left the left * @param right the right * @return the boolean */ public static boolean isSameSecond(DateTime left, DateTime right) { return isSameDay(left, right) && left.getSecondOfDay() == right.getSecondOfDay(); }
From source file:org.jpos.transaction.TxnId.java
License:Open Source License
/** * Creates new TxnId object/* w ww. j ava 2s. c om*/ * * @param dt Transaction's TIMESTAMP DateTime * @param node node id * @param transactionId TransactionManager's ID */ public static TxnId create(DateTime dt, int node, long transactionId) { TxnId id = new TxnId(); if (dt.getZone() != DateTimeZone.UTC) dt = dt.toDateTime(DateTimeZone.UTC); return id.init(dt.getYear() - 2000, dt.getDayOfYear(), dt.getSecondOfDay(), node, transactionId); }
From source file:org.movsim.consumption.offline.InputDataParser.java
License:Open Source License
private double convertToSeconds(String time) throws NumberFormatException, IllegalArgumentException { if (timeInputPattern.isEmpty()) { return Double.parseDouble(time); }//ww w.j a v a2 s . co m LOG.debug("timeInputPattern={}, time={}", timeInputPattern, time); DateTime dateTime = LocalDateTime.parse(time, DateTimeFormat.forPattern(timeInputPattern)) .toDateTime(DateTimeZone.UTC); LOG.debug("{} --> {}", time, dateTime); return dateTime.getSecondOfDay(); }