Get current system timestamp

I need to get the current system timestamp. How can I do?
Something like this
String strTimeStamp;
--> strTimeStamp = java.sql.Timestamp.toString(); ??????????
Thanks
Brian Nguyen

Use the following code:
String current = new Date().toString();The above code returns a string in the following format:
dow mon dd hh:mm:ss zzz yyyy
If you desire a different format have a look at the java.text.SimpleDateFormat class.

Similar Messages

  • How to get current system icon theme

    Hello every one.
    I need to create an ImageIcon object and set it's image to a folder icon image suitable with the current System ( i.e. Vista, XP, ... )
    So, I was wondering how can I get the icons of the system themes?
    any advice will be appreciated.
    thank you.

    Swing related questions should be posted in the Swing forum.
    set it's image to a folder icon image suitable with the current System You can get some Icons from the UIManager. Check out [UIManager Defaults|http://www.camick.com/java/blog.html?name=uimanager-defaults]. Start with the "FileView".
    You can also get the icons of specific applications using something like:
    (((ImageIcon) FileSystemView.getFileSystemView ().
        getSystemIcon (new File ("c:\\windows\\explorer.exe"))).getImage ());

  • How to get current system date and store in db

    may i know how to get the current system date so that i can store it into the database

    java.util.Date is NOT deprecated, just most of its methods are.
    Use
    new java.sql.Date(System.currentTimeMillis());to get the current date. Note that the date in a client machine
    may differ from the clock of the server!
    BTW: java.sql.Date extends java.util.Date.
    Fritz

  • To Get current System Name / Machine Name

    Hi all,
    Is there any thing to get the current System Name or Machine Name In PL/SQL?
    Thanks in advance.
    Regards,
    GowriShankar.N

    Try :
    SELECT p.pid, p.spid, p.program, s.sid, s.program
    into lvpid, lvspid, lvprogram, lvsid, lvprogram2
    FROM v$process p, v$session s
    WHERE p.addr = s.paddr AND s.sid = (SELECT sys_context('userenv', 'sid') FROM dual);
    display :
    PID SPID PROGRAM SID PROGRAM
    25 12278 oracleBECD@v480d-01 145 SQL Developer
    1 rows selected

  • What SAP function is used to get current system time?

    Hello All:
        I heard there is an SAP function to get system time. It was "gettime" or something! Could anyone please tell me what the function is?
    Thanks.
    Mithun

    Like this:
    DATA tt TYPE uzeit.
    GET TIME FIELD tt.
    This will reset sy-uzeit as well.
    Hmm... it appears I am mistaken. SY-UZEIT always seems to have the current time. I think this is a change from earlier releases.
    Rob
    Message was edited by:
            Rob Burbank

  • Get current system id

    Hi,
    I need to develope a web service (EJB) to get the id of the CE system the web service is running on. This will be later on used to distiguish between test and productive system.
    Anybody can help?
    Thanks and regards,
    Kevin

    Hi,
    You can get the it from a System Property.
    System.getProperty("SAPMYNAME");
    To get all possibilities, just do a System.getProperties() and see the all available properties.
    Best regards

  • Current System Time in Cold Fusion

    Hi,
    I am getting the current system Date as below:
    <cfset todaydate = CreateODBCDate(now())/>
    How to get current system time in coldfusion in a similar way
    and what is the syntax for it.
    <cfset currenttime = XXXXXXXXXXX/> which should be of
    24 hrs time format
    Could anyone please help me on this
    Thanks,
    Cold Fusion Beginner

    <cfset currenttime = XXXXXXXXXXX/> which should be of
    24 hrs time format
    <cfset currenttime = now()>
    That will be a date-time object of the current time. If you
    would like
    that formated in a standard 24 hour format:
    <cfset currenttime = timeFormat(now(), "HH:mm:ss")>
    The 'HH' time format mask is for hours in the 24 hour clock;
    'hh' will
    give you hours in a 12 hour format.

  • Getting accurate System time to milliseconds

    I have written a program which needs to do following two things
    1. make current thread sleep by some value in range 1 to 100 milliseconds
    2. Get current system, acurate to maximum accurate value in miliseconds
    as Java on Windows does not gurantee that Thread will sleep for the specified milliseconds and system time is also approximate, I need a solution that provides the guranteed accuracy for above two cases.
    Please help!!!
    Thanks in advance

    I have created a udp client/server. I am able to regulate the rate of packets (approx) on server, but the client time is shifting(slowing down).
    The basic function of client is to put set a variable client recieve time to the time on client and send packet back to server (to calculate delay on n/w).
    The server is sending data at correct timing (approximate), but the recieve time at client is shifting down slowly.
    I reduced the load on client by just discarding currrent packet and goto recieve next, but the delay is still there.
    The data captured is this (SS is Server Send time, CR is Client Recieve time)
    SS: 1108653459464 CR: 1108653447161
    SS: 1108653460464 CR: 1108653448161
    SS: 1108653461464 CR: 1108653449161
    SS: 1108653462464 CR: 1108653450161
    SS: 1108653463464 CR: 1108653451161
    SS: 1108653464464 CR: 1108653452161
    SS: 1108653465464 CR: 1108653453160
    SS: 1108653466464 CR: 1108653454160
    SS: 1108653467464 CR: 1108653455160
    SS: 1108653468464 CR: 1108653456160
    SS: 1108653469464 CR: 1108653457160
    SS: 1108653470464 CR: 1108653458160
    SS: 1108653471463 CR: 1108653459160
    SS: 1108653472479 CR: 1108653460145
    SS: 1108653473463 CR: 1108653461129
    // server time reduced by just 1 millisecond but client got mad
    SS: 1108653474463 CR: 1108653462129
    SS: 1108653475463 CR: 1108653463129
    SS: 1108653476463 CR: 1108653464129
    SS: 1108653477463 CR: 1108653465129
    SS: 1108653478463 CR: 1108653466145
    SS: 1108653479463 CR: 1108653467145
    SS: 1108653480479 CR: 1108653468145
    SS: 1108653481463 CR: 1108653469129
    SS: 1108653482463 CR: 1108653470129
    SS: 1108653483463 CR: 1108653471129
    SS: 1108653484463 CR: 1108653472129
    SS: 1108653485463 CR: 1108653473129
    SS: 1108653486463 CR: 1108653474129
    SS: 1108653487463 CR: 1108653475129
    SS: 1108653488479 CR: 1108653476129
    SS: 1108653489463 CR: 1108653477113
    SS: 1108653490463 CR: 1108653478129
    SS: 1108653491463 CR: 1108653479129
    SS: 1108653492463 CR: 1108653480129

  • How to get a current date timestamp ?

    Hi,
    I need to get the current date timestamp in a format DDMMYY HH:MM:SS.mmmm and store it in an Oracle column which is declared as of type DATE.
    Also i need to store this timestamp in a string format.
    Please give your inputs in this regard, which is appreciated.
    Regards

    Dates dont' have formats. String represenations of dates do.
    If you have a DB column that is of char or varchar type but represents a date/time, you should change your data model so that the column type is date or time or timestamp. If you can't do that, and need to put a date into a particular format, use java.text.SimpleDateFormat.
    To get the current date and time, look at System.currentTimeMillis, java.util.Date, java.sql.Date, java.sql.Timestamp.
    To put one of these into a database, use PreparedStatement. For example, a timestamp would be something like this: PreparedStatement ps = con.prepareStatement("insert into some_table (some_timestamp) values(?)");
    Timestamp ts = new TimeStamp(...);
    ps.setTimestamp(1, ts);
    ps.excuteUpdate();

  • Hyper-v replication Error Hyper-V received a digital certificate that is not valid from the Replica server 'burstingreplica'. Error: A required certificate is not within its validity period when verifying against the current system clock or the timestamp"

    Hi,
    When trying to initiate hyper-v replication from the main server i'm getting this error in the event logs.
    Hyper-V failed to enable replication for virtual machine 'RECADemo': A required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file. (0x800B0101). (Virtual Machine ID 561591B6-567C-...)--I'm using certificate based auth and cert is installed/recognized on both machines.Please help.Thanks,Jaffer
    Jaf

    Hi,
    This error occurs because the Microsoft Certificate Trust List Publisher certificate expired. A copy of the CTL with an expired signing certificate exists in the CryptnetUrlCache
    folder. Please try to renew the Trust List Publisher certificate.
    The related KB:
    Event ID 4107 or Event ID 11 is logged in the Application log in Windows and in Windows Server
    http://support.microsoft.com/kb/2328240
    How to Renew the Site Server Signing Certificate (Microsoft Certificate Services)
    http://blogs.technet.com/b/configmgrteam/archive/2009/02/11/how-to-renew-the-site-server-signing-certificate-microsoft-certificate-services.aspx
    Manage Trusted Publishers
    http://technet.microsoft.com/en-us/library/cc733026.aspx
    Hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • I need to get the Current System Date and time in the format

    I need to get the Current System Date and time in the format
    *6/24/2009 11:30:29 AM*
    How do i do it ?

    I seem to be saying this a lot lately.
    Google is your friend.
    I googled "java current date format" and SimpleDateFormat featured prominently in the results.

  • HT1338 I am trying to get my system current.  I am now running Mac OS X, version 10.6.8 (I believe this is "Snow Leopard".  What should I upgrade to?

    I am trying to get my system current.  I am now running Mac OS X, version 10.6.8 (I believe this is "Snow Leopard").  What should I upgrade to?

    The current system is OS X 10.8 which is downloadable from the App store, which you can upgrade to directly if your system meets the system requirements.  Note that starting with OS X 10.7, PowerPC-based programs will no longer run. So, for example, people with Office 2004 got surprised when they upgraded and found that the older Office programs would no longer run. Newer Office programs are OK.

  • I want to get List of all active sessions in current system

    Hi experts
    How to get list of all active sessions in current system in any internal table along with details.
    A sample code wud be helpful
    Thanks in advance.

    try this code it might help u.
    Below report execution gets the active Session list to ABAP memory
    submit rsm04000_alv and return exporting list to memory.
    refresh: gt_listobj.
    Below FM get the List output from ABAP memory to gt_listobj in HEX
    call function 'LIST_FROM_MEMORY'
      tables
        listobject = gt_listobj
      exceptions
        not_found  = 1
        others     = 2.
    if sy-subrc <> 0. " Executed successfully ?
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    This FM converts ITAB gt_listobj from HEX to ASCII
    call function 'LIST_TO_ASCI'
      tables
        listasci           = it_list
        listobject         = gt_listobj
      exceptions
        empty_list         = 1
        list_index_invalid = 2
        others             = 3.
    if sy-subrc <> 0. " Executed successfully ?
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    This Shows the output in List format on screen
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
       i_structure_name                  = 'line'
      tables
        t_outtab                          = it_list
    exceptions
       program_error                     = 1
       others                            = 2.
    if sy-subrc <> 0. " Executed successfully ?
    message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

  • How cost;ly it is to get the current system time

    I am using this call "System.currentTimeMillis()" to get the current system time. I need to now how costly it is to get the current system time.

    Why don't you time it -:) Run it 10000 times and print the first and last result. The difference is the time it took.

  • Cannot download OSX Maverick? My current system is Snow Leopard 10.6.8 and even when logged into the app store I'm getting the message that I can not download at this time. Try Later?

    Cannot download OSX Maverick? My current system is Snow Leopard 10.6.8 and even when logged into the app store I'm getting the message that I can not download at this time. Try Later?

    Are you connected via wifi? If so, and it is an option, try connecting using a ethernet cable. It sometimes seems to help as it can give a more reliable connection for the 5.3gb download.
    If you do manage to download it you may want to make a copy of the installer file - which gets downloaded to the Applications folder - before running it as it self-deletes on successful installation. It may save you another monster download in the future.

Maybe you are looking for