Current Position:Home > Regarding java.util.date / simple date format

Regarding java.util.date / simple date format

Update:11-30Source: network consolidation
Advertisement
Hi Friends,
I have a weired requirement where I am suppose to get time in millisecond for 3 scenarios.
1. next 07:00 time
2. next monday 07:00
3. on next 1st 07:00
Swing provides some jar where I can get next day - but not sure if I can play around to get my data.
need your inputs.
appreciate your quick reply friends,
Chintan
P.S. the reason I have to do so is
1. I have 3 kind of reports - few reports expire daily - few weekly - few monthly.
2. I am going to fetch the report from the external system and store (cache) in my db.
3. Administrator can configure that when exactly the report is going to be updated in external system.
4. So lets say for daily - every day at 7 it will be updated - so when I read the cached data, I want to compare the stored time stamp with next 7:00 time stamp and if my stored timestamp is less than next 7:00 time stamp - i can use the cached data and similarly for weekly and monthly.
Please let me know if you have more questions.

The Best Answer

Advertisement
I'll just add an example.
say I added a report to DB at 1188563489217 and my
cutoff is weekly that is on next monday at 7:00 in
the morning - at that time my milliseconds would be
1188783033888
now as far as my stored milliseconds are less than
1188783033888 i can read it from my db and if my
stored milliseconds are greater than 1188783033888
then I need to refetch the report.
Now for this task - every time i make a call to my DB
- i have to get time in milli seconds for next monday
7:00.
Is it possible??
I am badly struck over here - please guide.
Chintan
Appreciate your help buddies.
ChintanTake the hint if the date string is 35:11:2007 07:00 in dd:MM:yyyy HH:mm format then the parsed date will be 05:12:2007 07:00.
your problem is actually a piece of cake ;-)
  • I can't  cast  java.util.Date to  oracle.jbo.domain.Date Update:10-11

    Hi, i have a variable "pippo" type java.util.Date formatted like (dd-MM-YYYY hh:mm:ss) and I want insert in my Database where the field is Date type(oracle.jbo.domain.Date) in the same format(dd-MM-YYYY hh:mm:ss). I try to convert "pippo&qu

  • How can I use java.util.Date and change display format. Update:11-30

    Hello All, I want to use java.util.Date in View Context and in Custom Control Context of Web dynpro java. When i mapped of a Input Field to the java.util.Date then message shows that its not supported. Plz suggest me how to handle Date with different

  • Converting Java.util date to XML date in format YYYY-MMM-dd Update:10-11

    I'm using below code to convert java.util.date to XML date public static XMLGregorianCalendar toXMLDate(Date dte) {    try {    // this may throw DatatypeConfigurationException    DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();    Gr

  • Convert java.util.Timestamp to a formatted java.util.date Update:10-11

    Hi, I am trying to convert a java.util.TimeStamp date from the DB to a formatted date object. So, how can I convert this TimeStamp into an hourly or daily format that will return me a java.util.Date object? I was trying to convert the TimeStamp using

  • Convert java.sql.Date to java.util.Date Update:11-30

    How do i convert a java.sql.Date to java.util.Date ? SimpleDateFormat formatter = new SimpleDateFormat ("dd/MM/yy HH:mm"); Date received=myresultset.getDate(1); String utildate = formatter.format(received); <%=utildate%> Result : doesn't k

  • Error while deploying a web service whose return type is java.util.Date Update:10-11

    Hi I have written a simple web service which takes in a date input (java.util.Date) and returns the same date back to the client. public interface Ping extends Remote * A simple method that pings the server to test the webservice. * It sends a dateti

  • How to change a date value from "java.util.Date" to "java.sql.Date"? Update:10-11

    Hi all, How to change a date value from "java.util.Date" to "java.sql.Date"? I m still confusing what's the difference between them..... thanks Regards, KinThanks but my sql statement can only accept the format (yyyy-MM-dd) such as &qu

  • Wsimport, mapping of xs:date to java.util.Date via ext file, and -B option Update:10-11

    Summary: JDK 1.7.0_09 and wsimport and xjc that comes with it. Global JAXB binding to map xs:date to java.util.Date I have the following external bindings file: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="

  • Cannot convert from java.util.Date to java.sql.Date Update:10-11

    In the below code am trying to get the current date and 60 days prior date: Date  todayDate;           Date  Sixtydaysprior;           String DATE_FORMAT = "MM/dd/yy";           DateFormat sdf = new SimpleDateFormat(DATE_FORMAT);          Calend

  • Convert a String to java.sql.Date Format Update:11-30

    Hi, I am having a String of containing date in the format 'dd/mm/yyyy' OR 'dd-MMM-YYYY' OR 'mm-dd-yyyy' format. I need to convert the string to java.sql.Date object so that I can perform a query the database for the date field. Can any one suggest me