Dates...

Last post 01-13-2015, 7:09 AM by jmills. 2 replies.
Sort Posts: Previous Next
  • Dates...
    Posted: 01-12-2015, 8:33 AM

    I am looking to have a date set in my workflow as a variable and then also be able to reference a date 14 days past that date. I am running into the following issues:

     

    When I have the user use the datepicker (calendar) this is what I get back as a variable/output

    java.util.GregorianCalendar[time=1421038800000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2015,MONTH=0,WEEK_OF_YEAR=3,WEEK_OF_MONTH=3,DAY_OF_MONTH=12,DAY_OF_YEAR=12,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-18000000,DST_OFFSET=0]

    Is that what I should be expecting? If so how can I get a usable date from that and a date 14 days in the future?

    What I am doing is disabling Data Aging on a Client Group and I want to set the "Enable After" for two weeks later.


    -J. Mills
    Systems Engineer (Storage & Backup)
    CommVault Certified Master

  • Re: Dates...
    Posted: 01-12-2015, 5:37 PM

    The workflow stores these dates as java Calendar objects:

    http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html

     

    The calendar object has an add method in it for adding days to the inputted date.

    You can format date output string using SimpleDateFormat:

    http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

     

    Example:

    Calendar cal = xpath:{/workflow/inputs/myInputtedDate};
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String nowStr= sdf.format(cal.getTime());
    cal.add(Calendar.DATE,  14);
    String futureStr = sdf.format(cal.getTime());

    Let me know if you need any help with getting these values into the activity that is doing the data aging manipulation activity.
     

     

  • Re: Dates...
    Posted: 01-13-2015, 7:09 AM

    I guess that's a bit beyond me right now. I tried to implement it as a script step but I'm just getting an error. I did however figure out a way to do it against the CommServeDB by running this Query

    Select GETDATE() as 'Today',DATEADD (DAY,14, GETDATE()) as EndDate;

    The response is in a format that I can use it directly in the XML for the the data aging setup as well. It doesn't allow me to select a date, but for this workflow my main goal was to set a date 14 days our from when the workflow was run.


    -J. Mills
    Systems Engineer (Storage & Backup)
    CommVault Certified Master

The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Close
Copyright © 2019 Commvault | All Rights Reserved. | Legal | Privacy Policy