How to get the system date as a session attribute?

Hi all,
How can i get the system time and date to a session?
This is my code:
String startDate=<How will i get (system date) here?>;
session.setAttribute("startDate",startDate);
String startTime=<How will i get (system time + 1hr) here?>;
session.setAttribute("startTime",startTime);
Thanks in advance,
Lakshma

This is one way:
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sd1 = new SimpleDateFormat("yyyyMMdd");
        System.out.println(sd1.format(cal.getTime()));
        SimpleDateFormat sd2 = new SimpleDateFormat("hh:mm:ss");
        cal.add(Calendar.HOUR, 1);
        System.out.println(sd2.format(cal.getTime()));

Similar Messages

  • How to get the system date format string?

    Hello, everybody!
    I want to create a MaskFormatter with a mask for dates. So, I could suply as the constructor parameter: "##/##/####'. However, what if the year comes first in the current system date format settings, or the month is in the second place or in the first?... So, I can't just suppose that the current locale format for dates is like the one above. So, my question is: is there a way to get the SYSTEM DATE FORMAT STRING in Java? Searching in google I saw that this was already asked in this forum:
    http://forum.java.sun.com/thread.jspa?threadID=301034&messageID=1193794
    but there was no effective answer. Does someone already know how to get this?
    Thank you.
    Marcos

    Hi, not sure, but
    import java.text.*;
    SimpleDateFormat sdf = new SimpleDateFormat();
    System.out.println(sdf.toPattern());
    will output something like dd/MM/yy HH:mm
    hthThank you very much. It worked.

  • How to get the system date and time using java

    hi,
    I want system date in my out put. how to access system date. can v use utill packaegs (or) sql. which one is the best to get.
    Thanks & Regards,
    Kenny.

    import java.util.Date;
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    public class MyClass {
    public void setTimeStamp() {
    int hour, minute, second, time = 0;
    Date dt=new Date();
    System.out.println(dt.getDate());
    System.out.println(dt.getMonth());
    System.out.println(dt.getYear());
    Calendar cal = new GregorianCalendar();
    hour = cal.get(Calendar.HOUR_OF_DAY);
    minute = cal.get(Calendar.MINUTE);
    second = + cal.get(Calendar.SECOND);
    System.out.println (hour + ":" + minute + ":" + second);
    public static void main (String args[]){
    MyClass app = new MyClass();
    app.setTimeStamp();
    }

  • How can I get the system date in mm/dd/yyyy,

    how can I get the system date in mm/dd/yyyy, i need to compare system date with some other date,continuosly using threads,can U plz help me.
    With Some code
    Thanks In advnace
    Mahiiii

    Hi,
    You can use SimpleDateFormat class under java.text package.
    SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy h:mm a z", new Locale());
    //formatter.setTimeZone(timezone);
    String dateTime = formatter.format(new Date());

  • How to get the current date ? in the form of dd/mm/yyyy?

    Hi all,
    As getDate( ), getMonth( ), and getYear( ) is depricated, how to get the current date or System date, month and year ? please help ??
    Regards
    Ashvini

    HI,
    Than u for the reply. But i am getting one error.
    as u said, I tried to do so.........
    but, i am getting one error.
    code
    Calendar cald=(Calendar.getInstance.getTime());
    out.println(cald);
    error message
    validate$jsp.java:86: Attempt to reference method getInstance in class java.util.Calendar as an instance variable.
    Calendar cald=(Calendar.getInstance.getTime());
    ^
    1 error
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:284)
    Pls help
    Regards,
    Ashvini

  • How to get the system info in a network

    Hi to all.
    can any one tell me how to get the system related,like system name and logged user ,info in a network using java...
    thnx in advance,
    ashok

    There is quite a bit of data that is stored in the System Properties. Run this little test app and it'll display all of the System Properties, what you are looking for may be contained in there:
    public class Test {
        public static void main(String[] args) {
            System.getProperties().list(System.out);
    }

  • How to get the system time in a Swing application ?

    I know how to do it in JavaScript, but not java. Please help me, and also how to get the system time in an Applet. Thanks !!!

    Check this link, I hope it helps
    http://202.71.136.142:8080/globalleafs/Swing/View.jsp?slno=22&tbl=0

  • How to get  the actual data in ALV report

    I am doing some upgradation work   in that i am using Submit  & And return and  also i am using some function modules like LIST FROM MEMORY , LIST TO TXT wnd WRITE LIST , it gives output in normal list format , But i need to print in ALV report .
    With the use of set table for 1st display i got the  ALV report   but not with actual data, (some junk value is showing) , So can any 1 suggest me how to get  the  actual data in ALV report, With the use of  Any Function Module or with Coding,
    with regards,

    Hi Saravana
    I am sure you must be getting the values in tables of table parameters from every FM.
    consolidate the values from tables of all FMs in one table and built ALV for that table only.
    I hope this way you can show the actual data in ALV.
    thanks
    Lalit

  • How to get the "current date" in the BEx?

    Hi all,
    I need to get the "current date" in my Bex report in order to make a comparison. I know there is a "How to" which shows how to get the current date via a User Exit, but I didn't find it. Could you please help me?
    Thanks

    1. Create a  New Formula in Key Figures structure
    2. Give tech name and description and Select "New variable" option
    3. Next screen will launch Variable Wizard -> create a new variable with replacement path as processing type
    4. in next screene  select the date characteristic that represents the first date to use in the calculation (From Date)
    5. In the next  screen select Key in the Replace Variable with field. Leave all the other options as they are
    6. In the next Currencies and Units screen select Date as the Dimension ID.
    6. Save variable
    repeate the Above steps to create another variable (To Date)
    and now you can use these two new replacement path variables in your new formula.
    Dev

  • How to get the current date in a workflow

    Hey,
    Can anyone tell me how to get the current date while in a workflow?
    Thanks in advance.

    Here is how we did it, hope it helps
    <defvar name='locCalendar'>
    <new class='java.util.GregorianCalendar'/>
    </defvar>
    <defvar name='dateFormat'>
    <new class='java.text.SimpleDateFormat'>
              <s>MM/dd/yyyy</s>
         </new>
    </defvar>
    <defvar name='formatedDate'>
         <invoke name='getTime'>
    <ref>locCalendar</ref>
    </invoke>
    </defvar>
    <invoke name='format'>
    <ref>dateFormat</ref>
    <ref>formatedDate</ref>
    </invoke>

  • How to get the context data using java script in interactive forms

    Hi All,
    How to get the context data using java script in interactive forms by adobe,  am using web dynpro java
    thanks.

    Hi venkat,
    Please Refer this link.
      Populating one Drop-Down list from the selection of another Drop-down list
    Thanks,
    Raju.

  • How to get the manufacturing date of iphone 5s?

    how to get the manufacturing date of iphone 5s?
    thanks

    Enter your serial number here:
    www.appleserialnumberinfo.com/Desktop/index.php
    To find your serial number:
    Settings > General > About > Serial Number

  • How to get the pixel data so as to work on it?

    Hi all,
    I am trying to write a plug-in that will crop and scale the image, edit the selection in the image document based on image data. For this purpose I need the pixel data of the image. How to get the image data as different pixels and what is the data structure used to store this data?
    Assumption: No layers i.e., only background
    Thanks in advance,
    Sailu

    Hi Ilya,
    Thank you for your post. In the plugin architecture you propose (automation + filter), do you have an idea about how to share the pixel data between the two plugins? I have found a post that gives details about how to get pixel data and show it using ADM components
    Matthew Hollingworth, "ADM Color Managed Preview?" #1, 22 Oct 2007 11:53 pm but it supposes that you have a filter plug-in.
    Again, does anyone knows how to preview the current image in a AUTOMATION plug in? This seems impossible.
    Thank you all for your help
    Cheers,
    Chaker

  • When plugging in an iPad in Apple Configurator, it is not being read under USB Connected so I can't update it.  Any ideas on how to get the system to read the iPad?

    When plugging in an iPad in Apple Configurator, it is not being read under USB Connected so I can't update it.  The iPhoto window opens up and reads the photos on the iPad, so it is connecting to the computer.  Earlier today I wasn't having any problems.  I have shut down the iPad and the computer and started over, but that didn't help.  Any ideas on how to get the system to read the iPad so I can update the apps on it?

    Hi, is the problem just to update your apps on your iPad? Here is what you should check. Is the iTunes on your computer updated to the latest version? Does your iPad needs to be updated? Do you have enough storage on your iPad to do the update? On your device is your iCloud back up checked?
    Go to Settings - iCloud - Backup/Storage - see if its checked, and try unchecking it before connecting it to the computer.
    Please let me know if you need any further assistance.

  • How to remove the system data details from the overview tab in crmd_order?

    Hi All,
    How to remove the system data details from the overview tab in crmd_order?

    Hi,
    It is a standard functionality. Those information will be very useful when you send a message to SAP.
    If you still want to remove them, raise an OSS message.
    Regards,
    Rajesh Kumar

Maybe you are looking for

  • 2101nw print server (and LaserJet M1132 MFP) – installation problems on Windows 7 (64bit)

    For two years, I've been a happy user of an HP printer (LaserJet M1132 MFP), wirelessly connected to my home network thanks to a HP Wireless G Print Server HP 2101nw. A week ago, a new machine came in and – to align operating systems - I had to insta

  • X-Axis Scales and Dates Issue

    Hello, really hoping that someone can help me. I have a crystal reports report with a chart. The chart uses dates as the x-axis and numeric values on the y-axis. All I want to do is change the x-axis sacle to be 14 day intervals. Seems simple enough.

  • Get graphics in a Dialog box

    Hello, I have an evoluating curve: To do this, I generate a channel, i open it in a report file and refresh it periodicaly during the process. I Would like to see the curve evolution and have buttons in the same time to act on the process. Is it poss

  • Central Instance Java Server0/Server1 not starting

    We recently installed a new dialog instance for our CUA system (abap and java stacks). Now, whenever the Java stack fully initializes itself on the Dialong Instance first, the Server0 and Server1 on the Central Instance Java stack will not complete t

  • Anyone know why the iCloud tab is missing from the iPhone in Safari?

    When I open a web page from my iPhone, I can view the same page on my iPad by opening the iCloud tab, but if I open a web page from my iPad and then wish to view it on my iPhone, I am unable to because the iCloud tab is not visible on the phone when