List of usage examples for java.util Date toString
public String toString()
where:dow mon dd hh:mm:ss zzz yyyy
From source file:it.jugpadova.blol.FeedsBoTest.java
public void testConvertDateAndTime() throws ParseException { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); df.setTimeZone(TimeZone.getTimeZone("GMT")); TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); net.fortuna.ical4j.model.TimeZone tz = registry.getTimeZone("GMT"); Date d = df.parse("18/09/2009"); net.fortuna.ical4j.model.Date cd1 = feedsBo.convertDateAndTime(d, "12:00 AM", tz); assertEquals("20090918T120000", cd1.toString()); net.fortuna.ical4j.model.Date cd2 = feedsBo.convertDateAndTime(d, "05:00 PM", tz); assertEquals("20090918T170000", cd2.toString()); }
From source file:it.jugpadova.blol.FeedsBoTest.java
public void testConvertDateAndTimeBrazil() throws ParseException { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); df.setTimeZone(TimeZone.getTimeZone("America/Sao_Paulo")); TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); net.fortuna.ical4j.model.TimeZone tz = registry.getTimeZone("America/Sao_Paulo"); Date d = df.parse("18/09/2009"); net.fortuna.ical4j.model.Date cd1 = feedsBo.convertDateAndTime(d, "12:00 AM", tz); assertEquals("20090918T120000", cd1.toString()); net.fortuna.ical4j.model.Date cd2 = feedsBo.convertDateAndTime(d, "05:00 PM", tz); assertEquals("20090918T170000", cd2.toString()); }
From source file:io.dockstore.client.cli.Client.java
private static void info(List<String> args) { if (args.isEmpty()) { kill("Please provide a container."); }/*from w w w. java 2 s . c o m*/ String path = args.get(0); try { Container container = containersApi.getContainerByToolPath(path); if (container == null || !container.getIsRegistered()) { kill("This container is not registered."); } else { // out(container.toString()); // out(containersApi.getRegisteredContainer(path).getTags().toString()); // Container container = containersApi.getRegisteredContainer(path); Date dateUploaded = container.getLastBuild(); String description = container.getDescription(); if (description == null) { description = ""; } String author = container.getAuthor(); if (author == null) { author = ""; } String date = ""; if (dateUploaded != null) { date = dateUploaded.toString(); } out(""); out("DESCRIPTION:"); out(description); out("AUTHOR:"); out(author); out("DATE UPLOADED:"); out(date); out("TAGS"); List<Tag> tags = container.getTags(); int tagSize = tags.size(); StringBuilder builder = new StringBuilder(); if (tagSize > 0) { builder.append(tags.get(0).getName()); for (int i = 1; i < tagSize; i++) { builder.append(", ").append(tags.get(i).getName()); } } out(builder.toString()); out("GIT REPO:"); out(container.getGitUrl()); out("QUAY.IO REPO:"); out("http://quay.io/repository/" + container.getNamespace() + "/" + container.getName()); // out(container.toString()); } } catch (ApiException ex) { // if (ex.getCode() == BAD_REQUEST) { // out("This container is not registered."); // } else { // out("Exception: " + ex); // } kill("Could not find container"); } }
From source file:managedBean.CiudadBean.java
public String getFecha() { //Recuperar la fecha actual Date midate = new Date(); String[] verfecha = midate.toString().split(" "); this.fecha = verfecha[2] + "/" + verfecha[1] + "/" + verfecha[5]; return fecha; }
From source file:CiudadesApp.Modelo.Actions.Ciudad_Actions.java
public String getFecha() { Date midate = new Date(); String[] verfecha = midate.toString().split(" "); String mifecha = verfecha[2] + "/" + verfecha[1] + "/" + verfecha[5]; return mifecha; }
From source file:com.mobshep.mobileshepherd.UDataLeakage.java
private void logDetails(String content) { // TODO Auto-generated method stub Date date = new Date(); String filename = "LogFile" + date.toString(); String EOL = System.getProperty("line.seperator"); BufferedWriter writer = null; try {//from w w w. jav a 2 s .c o m writer = new BufferedWriter( new OutputStreamWriter(openFileOutput(filename, Context.MODE_WORLD_READABLE))); writer.write(content + EOL); writer.write(date + EOL); } catch (Exception e) { e.printStackTrace(); } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { e.printStackTrace(); } } } }
From source file:org.toobsframework.scheduler.AppScheduler.java
public void init() { try {/*from ww w . j a va 2 s .c o m*/ SchedulerFactory sf = new StdSchedulerFactory(); scheduler = sf.getScheduler(); Iterator<AppScheduleInfo> iter = appSchedules.iterator(); while (iter.hasNext()) { AppScheduleInfo appInfo = (AppScheduleInfo) iter.next(); try { JobDetail job = new JobDetail(appInfo.getJobName(), appInfo.getGroupName(), java.lang.Class.forName(appInfo.getJobClass())); String jobSchedule = appInfo.getJobSchedule(); String jobSchedOvr = configuration.getProperty(appInfo.getJobEnvCronProperty()); if (jobSchedOvr != null && jobSchedOvr.length() > 0) { jobSchedule = jobSchedOvr; } CronTrigger trigger = new CronTrigger("Trigger-" + appInfo.getJobName(), "Trigger-" + appInfo.getGroupName(), appInfo.getJobName(), appInfo.getGroupName(), jobSchedule); scheduler.addJob(job, true); Date ft = scheduler.scheduleJob(trigger); log.info("Job " + job.getName() + " will next run at " + ft.toString()); } catch (ClassNotFoundException e) { log.error("Job " + appInfo.getJobName() + " class " + appInfo.getJobClass() + " not found"); } } scheduler.start(); memMon = MemoryMonitor.getInstance(); } catch (ParseException e) { log.error("ParseException in AppScheduler " + e.getMessage(), e); } catch (SchedulerException e) { log.error("SchedulerException in AppScheduler " + e.getMessage(), e); } }
From source file:edu.lafayette.metadb.web.authentication.Login.java
/** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */// w ww . j av a2 s .c o m protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub PrintWriter out = response.getWriter(); String username = request.getParameter("username-login"); String pwd = request.getParameter("password-login"); JSONObject output = new JSONObject(); try { User user = UserManDAO.getUserData(username); //SysLogDAO.log(username, Global.SYSLOG_AUTH, "User "+username+" trying to login."); //User != null means DB conn succeeded if (user != null && !user.getUserName().equals("")) { MetaDbHelper.note("User is not null."); if (UserManDAO.checkPassword(username, pwd)) { SysLogDAO.log(username, Global.SYSLOG_AUTH, "User " + username + ": successfully logged in."); long last_login = new Long(user.getLast_login()); HttpSession session = request.getSession(); String project = ProjectsDAO.getProjectList().isEmpty() ? "" : ProjectsDAO.getProjectList().get(0); setUpSession(session, username, project); String last_date = ""; if (!UserManDAO.updateLoginTime(username, session.getLastAccessedTime())) last_date = "error"; else if (last_login != 0) { Date date = new Date(last_login + 5 * 3600 * 1000); last_date = date.toString(); } session.setAttribute(Global.SESSION_LOGIN_TIME, last_login); output.put("username", username); output.put("admin", user.getType().equals(Global.USER_ADMIN)); output.put("local", user.getAuthType().equals("Local")); output.put("last_login", last_date); output.put("success", true); output.put("parser_running", MetaDbHelper.getParserStatus()); output.put("record_count", MetaDbHelper.getItemCount()); output.put("log_types", Global.eventTypes); String[] last_page = UserManDAO.getLastProj(username).split(";"); if (last_page.length > 1) { output.put("last_proj", last_page[0]); output.put("last_item", last_page[1]); } } else { SysLogDAO.log(username, Global.SYSLOG_AUTH, "User " + username + ": Authentication error, could not log in."); output.put("success", false); output.put("message", "Username/Password mismatch"); } } else if (user != null && user.getUserName().equals("")) { SysLogDAO.log(Global.UNKNOWN_USER, Global.SYSLOG_AUTH, "UNKNOWN user: " + username); output.put("success", false); output.put("message", "Username/Password mismatch"); } else { output.put("success", false); output.put("message", "Connection to database cannot be established"); } out.print(output); } catch (Exception e) { MetaDbHelper.logEvent(e); } out.flush(); }
From source file:org.jasig.cas.ticket.registry.JpaTicketRegistry.java
private void removeTicket(final Ticket ticket) { try {/*from ww w . j av a2 s.c o m*/ if (log.isDebugEnabled()) { final Date creationDate = new Date(ticket.getCreationTime()); log.debug("Removing Ticket >" + ticket.getId() + "< created: " + creationDate.toString()); } entityManager.remove(ticket); } catch (final Exception e) { log.error("Error removing " + ticket + " from registry.", e); } }
From source file:org.jasig.portlet.test.mvc.tests.EventTestController.java
@EventMapping("SimpleTestEvent") public void simpleEventHandler(EventRequest eventRequest, EventResponse eventResponse) { final Event event = eventRequest.getEvent(); logger.info("Handling SimpleTestEvent: {}", event); final Date value = (Date) event.getValue(); logger.debug("Setting render parameter simpleEvent={}", value); eventResponse.setRenderParameter("simpleEvent", value.toString()); }