I Need to Write the current Date and Time

I need to write the current date and time to calculate the spend time in each instruction.
What is the instrucion?
Thanks.
MIGUEL ANGEL CARO
[email protected]

The current time can be determined with a Date object:
Date now = new java.util.Date() ;or if you are interested in the seconds since the epoch:
System.currentTimeMillis() ;If you wanted to print them out:
System.out.println( new java.util.Date() ) ;
System.out.println( System.currentTimeMillis() ) ;Kenny

Similar Messages

  • How to get the current data and time of SCOM server via SCOM SDK (API) calls?

    Hi,
    I need to read the current date and time of SCOM server via SOM SDK.
    Is there a class in SDK that provides this info ?
    Thanks,
    satheesh

    To get time and date of Alerts of SCOM, You can use following command let "get-scomalert"
    Also, You can refer below links
    http://blog.tyang.org/2013/02/21/using-scom-2012-sdk-to-retrieve-resource-pools-information/
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical

  • How to display the current Date and time in xslt version 1

    i am using xslt version 1 .i want to display the current date and time in the output xml using xslt(Jdeveloper) ..i just added the namespace xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
         xmlns:ns1="urn:oracle:integration:b2b:7D30046DC68A4FA689956D8241FA3B99">
    and used thsi function <xsl:value-of select = "xp20:current-date()"/>
    but it does not works for me ..help needed????
    Edited by: user9519185 on Jan 20, 2009 3:04 AM

    Use a formula: =NOW()
    Format the cell for Date and Time, with both the Date part and the Time part displayed. Format the two parts as you wish, using the choices in the Inspector's menus.
    The cell will update each time the table is recalculated.
    (Description is for Numbers '09 (Mac), Numbers for iOS will be similar, but not necessarly identical in details.)
    Regards,
    Barry

  • Wrote the current Date and Time in the backend

    HI everyone,
    I created a table view, where I display several records. Right now I will add an record to this table, which should be written back in the backend and automaticaly add the current date and time.
    But I don´t know to make this. I tried several time with the funktion  "now()", but it doesn´t work. So any help for me, to explain how I can display the actual time and then write it back to the backend?
    Thanks

    we use a crm system. but the BAPI I mentioned was
    just to play with. My basis will develop a new API
    for the project, that have the requested Inputfields.
    But what I tottaly forget was, that there has to be a
    field for the time, so thanks for the advice.
    No Problem.
    I´m still of the opinion , that it should be possible
    to add the curret time in a field with the
    funcionality of the VC, even there is a way to show a
    clock with the current time. My problem is that I
    can´t figuer out how to do this.
    Therefore you can use the TNow() function (Time functions) and the Now() Function (Date functions). You can cast them to a string and concatenate the string, then you have the date of today with the current time. This string you can format and transfer it as input for your BAPI_ADD_BP for example.
    Hope that helps.
    Best Regards,
    Marcel

  • I'm trying to display the current date and time on my iPad.

    First, I'm not sure this is a valid post to this forum.  If not, I'd appreciate knowg in where I can get help. 
    I have tried several ways to display the current date and time on my iPad.  None  work.  Most things I try give me complier errors but the latest code compiles but won't display the correct time. 
    Here's the dispatch code in my ViewController.m file:
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
        dispatch_async(queue, ^{
            [NSTimer scheduledTimerWithTimeInterval:NSTimeInterval)1.0f target:self selector:@selector(updateLabel:) userInfo:nil repeats:YES];
    Here's the updateLabel code: (which never gets executed).
    - (void)updateLabel:(id) sender {
        dispatch_sync(dispatch_get_main_queue(), ^{
        NSLog(@"Datefield Update Called");
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"EEEE, MMMM dd, yyyy 'at' HH:mm  ZZZZ"];
        NSDate *dayTime = [NSDate date];
        NSString *formattedDateString = [dateFormatter stringFromDate:dayTime];
            _dateField.text = formattedDateString;
        [self.view addSubview:_dateField];
        NSLog(@"Datefield %@",_dateField.text);

    Your code is needlessly complicated and has a few problems:
    // These objects should be created only once.
    NSTimer *dateAndTimeTimer; (You might need to make this a property with a strong reference).
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"EEEE, MMMMM dd, yyyy 'at' HH:mm ZZZZ"];
    // The subview should only be added once.
    [self.view addSubview:_dateField];
    [self performSelectorOnMainThread:@selector(startDateAndTimeTimer)
                            withObject:nil
                         waitUntilDone:YES];
    -(void)startDateAndTimeTimer
        NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1
                                                          target:self
                                                        selector:@selector(updateLabel)
                                                        userInfo:nil
                                                         repeats:YES];
        dateAndTimeTimer = timer;
        [[NSRunLoop mainRunLoop] addTimer:dateAndTimeTimer forMode:NSRunLoopCommonModes];
    -(void)updateLabel
         NSDate *dateTime = [NSDate date];
         NSString *formattedDataString = [dateFormatter stringFromDate:dateTime];
         _dateField.text = formattedDateString;
         NSLog(@"_dateField.text=%@", _dateField.text);

  • Put the current date and time in a string

    I am having trouble trying to put the current date and time from my Calendar object into a string
    any ideas?

    Calendar timeCal = Calendar.getInstance();
    timeCal.setTime(new Date(System.currentTimeMillis() - startTime ));
    String date = formatToTwoDigits(timeCal.get(Calendar.HOUR_OF_DAY))     + ":" +
    formatToTwoDigits(timeCal.get(Calendar.MINUTE))          + ":" +
    formatToTwoDigits(timeCal.get(Calendar.SECOND));
    private String formatToTwoDigits(int i) {
    String ret = null;
    i = i % 100;
    if (i < 10) {
    ret = "0" + Integer.toString(i);
    } else {
    ret = Integer.toString(i);
    return ret;
    You can figure out yourselve how to display the date, use other Calendar.XXX properties.
    Good luck!

  • Get the Current Date and Time of a Location

    I have created a windowsPhoneApplication in silverLight 8.1.In my application,I have to upload videos on some server.The Uploading get failed If the Date and Time settings of my device is not the current Date and Time.So How can I get the current date
    and time even if the device settings is wrong?

    Hi shifana,
    Do you know server's time zone? If yes, you can manually translate to the correct time zone.
    Otherwise try some online time acquire API.
    --James
    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.
    Click
    HERE to participate the survey.

  • HT3180 setting date and time - my apple tv get stuck and says it needs to set the network date and time.  Does anyone know how to do this?

    My apple tv gets stuck and says it need to set the date and time on the network.  Does anyone know how to do this?

    I was able to get my Apple TV working again by downgrading the firmware following the instructions in this message:
    https://discussions.apple.com/message/20008613#20008613
    In case that message disappears, here's my translation:
    1. Connect your Apple TV to your computer via USB. Don't plug in the power cable.
    2. Download the older 5.0.2 firmware from Apple here:
    5.0.2 (Apple TV 2): AppleTV2,1_5.0.2_9B830_Restore.ipsw
    5.0.2 (Apple TV 3): AppleTV3,1_5.0.2_9B830_Restore.ipsw
    3. Open iTunes and select the Apple TV. Hold down the option key and press the restore button at the same time.
    4. In the dialog that opens select the firmware that you downloaded.
    5. The restore process will take a few minutes. Once it's done plug your Apple TV back into your TV. If the date and time message persists just press the menu button to skip it. This got mine working again.

  • Need help restoring the CORRECT dates and times to iphoto '09 photos

    I have read a lot of stuff on here about restoring dates and times in iphoto only to no avail. All I want to know is: 1 - how did all the dates of my photos get changed in the first place? ; 2 - how can I restore them to their original dates?

    Well, I noticed my dates were incorrect weeks ago. The only thing I did was upgrade from '08 to '09. I tried using "adjust date & time" but I would have to know all the dates by memory in order for that to work. My dates are all recent dates. Sorry for the ambiguity.
    Forget what I said about the event labels. They are titles I made for each event; however, all of the dates are incorrect. Maybe my camera is to blame!
    Message was edited by: Sold on Mac

  • Sample XSLT code to Display the Current date and time

    Hi all,
    Please Let me know code to display the system date in my target in xslt mapping.
    I am trying fn:current-datetime() function for the same.but could not get how to use it .Is it  function right  function.If so please send me the examples on the same.
    Thanks and Regards,
    Srini

    hey
    use this date:date-time()
    also have a look at this
    http://www.w3.org/TR/xpath-functions/#func-current-dateTime
    thanx
    ahmad

  • How to print the current date and time?

    Hi Friends!
    I have tried this program to print the current time and date,
    #include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    time_t tim;
    time(&tim);
    cout << ctime(&tim);
    return 0;
    But it show the warning as;
    warning C4996: 'ctime': This function or variable may be unsafe. Consider using ctime_s instead.
    Can anyone suggest whats wrong with this?

    i also got many warring when i use old version keyword. as i note on think thatin new vc++ has many keyword change with _s. the old keyword works even get warring.or you can change to as it suggest.For About ctime_s
    Check this link for more detail (RefLink)
    No, it shows error, when you use ctime_s instead of ctime.
    error C2660: 'ctime_s' : function does not take 1 arguments

  • Need to display current date and time in arabic

    Hi,
    I'm very new to arabic and probable this is sumthing simple.
    I have to work on a flash arabic application.
    Through actionscript 2 I'm getting the current date and time.
    I want to display this in arabic. Please suggest me a solution.
    Thanks
    Sunira

    You would have to work out some font or something. I have no experience with Arabic

  • Query to deduct the time from current date and time

    I want to get the query to deduct time(180 mins) from the current date and time.
    Regards
    Pavan

    SQL> select to_char(sysdate,'dd.mm.yyyy hh24:mi:ss') curr,
      2         to_char(sysdate - interval '180' minute,'dd.mm.yyyy hh24:mi:ss') past from dual
      3  /
    CURR                PAST
    24.08.2007 16:18:37 24.08.2007 13:18:37
    SQL> 

  • Displaying Current Date and Time in JSP

    Hi,
    I need to insert the current date time in Ms SQL Server Database using jsp page. The format of the code willbe
    insert into table(update_date) values ('2007-01-01 10:02:21');
    But i am not getting how to display the current date and time ie. 2007-01-01 10:02:21 using jsp.
    I have tried using
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    GregorianCalendar cal = new GregorianCalendar();
    String dd = sdf.format(cal.getTime());
    insert into table(update_date) values (dd);
    But it didnot get inserted data.
    Can anybody figure out with simple ideas.
    Thank You

    Why then are you trying to insert the current date on a table?
    To show the current date on the JSP you might try
    <%=new Date()%>Or the way you had it on your first post with the date formatter and then use the <%=%> tags. Anyway, it seems to me I'm not really understanding what you actually want to do :-p
    P.S. NOW() is a MySQL function too, not only MSSQL server (didn't even know it had it too ;-))
    mysql> insert into a(up) values (now());
    Query OK, 1 row affected (0.00 sec)
    mysql> select * from a;
    +------------+
    | up         |
    +------------+
    | 2007-04-09 |
    +------------+Message was edited by:
    benubach
    Message was edited by:
    benubach

  • Insert current date and time into Oracle date type field

    I have a JDBC current date and time insert into Oracle 9i that almost works. It submits the current date and a fixed time into the Oracle date type field. I am using Tomcat 6.0.20.
    For example if I insert the data at 7:24:04 PM on Feb 16, 2010 it will insert as: 16-Feb-2010 12:00:00 AM
    The date part works but the time always shows 12:00:00 AM no matter what date or time the data is inserted.
    Here is what I have for my JDBC inserts and I also tried something with DateFormat:
    PreparedStatement ps; Date mydate = new Date(new java.util.Date().getTime()); //insert statement here.... stmt.setDate(1,mydate);
    I also tried:
    PreparedStatement ps; java.sql.Timestamp mydate = new java.sql.Timestamp(new java.util.Date().getTime()); SimpleDateFormat fmt = new SimpleDateFormat(.... //insert statement here.... ps.setTimestamp(1,fmt.format(mydate));
    Both keep submitting the date into Oracle as 16-Feb-2010 12:00:00 AM
    Anyway to get the current date and time? For example if I insert the data at 7:24.04 pm today it should show as 16-Feb-2010 07:24.04 PM in Oracle.

    sportsMarkr wrote:
    Date mydate = new Date(new java.util.Date().getTime());Please see the javadocs for java.sql.Date and note the part that says "...to zero"
    [http://java.sun.com/javase/6/docs/api/java/sql/Date.html]
    If you want a date and time then use java.sql.Timestamp.

Maybe you are looking for

  • Hyperion Enterprise Web Server  - Error 406

    Hi, The problem occurs when trying to activate the Hyperion Enterprise webserver from the Server Administration. The error message displays "HTTP 406 error". We have tried many things including a full reinstall but have not managed to find a solution

  • How can I copy a movie through homesharing

    How  can I copy a movie with the new itunes through homesharing?

  • Balance sheet and schedules

    I have to develop Balance sheet , P&L , All the schedules , Funds Flow , Cash Flow , Working capital statement , Ratio Analysi in BI. I believe I can use 0FIGL_C10 to develop BS , PL , Funds Flow and Cash Flow. Can anyone suggest me how I can develop

  • Solaris 9 - KDE won't work

    Installed KDE 3.1 (Support CD version) on Solaris 9 on E450 (dumb terminal console). Followed instructions as per installing and running kde bla bla bla http://www.sun.com/bigadmin/content/submitted/kde_on_sun.html Cannot get X-windows emulator (Exce

  • I have updated to Mountain Lion but both Mountain Lion and Lion are showing up in my App store as needing to be downloaded? Help

    I have updated my mac pro to Mountain Lion, but when I go into my updates in App store it shows both Lion and Mountain lion needing to be updated. They are not coming with a cancel option and when I download Mountain Lion it tries to download for a v