Current date month year in flex

can anyone let me know how to get current system date in flex
and how to compare seleted date and system date in flex
thanks in advance

below is the example code which get the date, month and year
when you try to access the month it return less than one (if you try to get the month when the month is set to jan it return zero ) while displaying we need to increment as months starts from one
import mx.controls.Alert;
public function init():void
var dt:Date= new Date();
Alert.show("date : "+dt.getDate().toString()+"\nmonth : "+Number(Number(dt.getMonth().toString())+1) +"\nYear : "+dt.getFullYear().toString());
if this post answers your question or helps, please mark it as such

Similar Messages

  • FM to calculate date month & year six months previous to the current date

    Hi All,
    Is there any function module or code to calculate date month & year six months previous to the current date.
    Thanks in advance.

    hi,
    try this
      data : date1 like vbak-erdat.
    data : q type numc3.
    selection-screen : begin of block blk2 with frame title text-001.
    parameters : n like q.
    selection-screen : end of block blk2.
    if n > 0.
    CALL FUNCTION 'CCM_GO_BACK_MONTHS'
             EXPORTING
               CURRDATE         = sy-datum
               BACKMONTHS       = n
           IMPORTING
              NEWDATE          = date1
    selection-screen: begin of block blk1 with frame title text-001.
    select-options :  s_date for vbak-erdat default 'NEWDATE'  to 'sy-datum' no-display.
    selection-screen : end of block blk1.
    write : date1.
    Reward with points if helpful.

  • Setting date,month,year and time

    How do i change the Date /month/year and time on my printer.
    My printer is    Laser Jet Professional M1212 nf mfp

    Please to here and download the User Guide.
    http://h10025.www1.hp.com/ewfrf/wc/manualCategory?cc=us&dlc=en&lc=en&product=3965849&
    Here you will find all you information you requested. 
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • Current date + 1 year

    Hi,
    Can anyone please tell me what is the easy method to calculate current date + 1 year?
    Is there any function module available?
    Thanks..
    Swetha.

    Beware of Leap Years.
    I Tried this and it works
    data date type sy-datum.
    data i_date type sy-datum value '20080229'.
    CALL FUNCTION 'ADD_TIME_TO_DATE'
      EXPORTING
        I_IDATE                     = i_date
        I_TIME                      = '1'
        I_IPRKZ                     = '3'
    *   I_RDMHD                     =
    IMPORTING
       O_IDATE                     = date
    * EXCEPTIONS
    *   INVALID_PERIOD              = 1
    *   INVALID_ROUND_UP_RULE       = 2
    *   INTERNAL_ERROR              = 3
    *   OTHERS                      = 4
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write date.
    i_iprkz = 3 means years and i_time is the increase

  • Show Current Date in Year Format (and now - 1, etc.)

    Our form has some column headers that need to change each year, the headings are current year (2010) + previous 3 years.  Am trying to programatically add the titles to eliminate modifying the form just to change the year, but not finding how to accomplish, and was checking out some date samples found, but no success yet.  My question is 2 part - how/where do I put code, I don't need the user to enter anything, just want a column header.  This example below is where I copied the idea from a sample and tried to adjust, it's on the calculate event of a date/time field, and I get an error message that says 'the display pattern "date-{MM/DD]" is incompatible with the object's data format.  Define a compatible Display pattern.  This display pattern error is the 2nd part of the question.  How do I display only the 4 digit year?
    year1.rawValue
    = num2date(date(), "YYYY")
    How do I accomplish this - am newbie on this!  Thank you very much!

A: Show Current Date in Year Format (and now - 1, etc.)

1) I typically use a hidden field to capture the current date on the layout:ready event.
2) If year1 is a date object  your script is valid but you are probably missing the display pattern date{YYYY} on year1.
If year1 is a text field you could could capture current year in a hidden field as
// form1.page1.currentYear::ready:layout - (FormCalc, client)
$.rawValue = Num2Date(Date(), "YYYY")
where currentYear has the display pattern date{YYYY} and add
this.rawValue = form1.page1.currentYear.rawValue;
to the calculate event of year1.
Steve

1) I typically use a hidden field to capture the current date on the layout:ready event.
2) If year1 is a date object  your script is valid but you are probably missing the display pattern date{YYYY} on year1.
If year1 is a text field you could could capture current year in a hidden field as
// form1.page1.currentYear::ready:layout - (FormCalc, client)
$.rawValue = Num2Date(Date(), "YYYY")
where currentYear has the display pattern date{YYYY} and add
this.rawValue = form1.page1.currentYear.rawValue;
to the calculate event of year1.
Steve

  • IPhoto only accepts date/month/year format for pics?

    I'm trying to add the dates to many old photos that I have in my iPhoto, version 8.1.2.
    Unfortunately, I have many years of photos in there, and I can't remember exact dates of many photos.
    And so I just want to at least put the month and the year. Or sometimes, I'll just remember the year.
    But iPhoto will only let me use a date/month/year format. Odd.
    Is there any way around this?
    Somehow, many of my old photos that have been transfered from old computers have dates assigned to them that are crazy, like 1960....etc.
    I can just make up a date and a month, but that takes more time, and furthermore it will be wrong info.
    I don't want that.
    It seems silly that I can't just put the year alone.
    Any thoughts?
    thank you!

    it also seems like the albums of photos will use the date of the earliest photo in the album, and the newest photo in the album to create a "from" field and a "to" field, in the "info" section at the bottom left of the application, when the Album is highlighted.
    This means that I have to manually correct every single photo in my albums, so that the album date range will read correctly?
    thanks again...

  • Help creating a formula which returns current date last year

    I need help creating a formula which returns the current date last year. I also need it to work during leap years.
    Any ideas?

    Hi Dagros,
    I'm lucky to be a universe designer, I have to do this only once
    The easiest way would probably be to use
    =RelativeDate(CurrentDate();-365)
    So subtractiing 365 to get the same date last year,
    but you would need some extra logic for the years with a feb 29 in those 365 days.
    =If FormatDate(RelativeDate(CurrentDate();-365);"dd") = FormatDate(CurrentDate();"dd")
    Then RelativeDate(CurrentDate();-365)
    Else RelativeDate(CurrentDate();-366)
    Another question to ask is if you really want the same date last year, or if you also want a really 'same day' so monday compared to monday etc. in this case you would just subtract 364 days and get the day 52 weeks back...
    Good luck,
    Marianne

  • Current date - 2 years

    Hi
    I need to get one of the report header column  like  current year - 2 based on the current date.
    For suppose format is like below
    2010 03
    if todays date is  10/03/2012
    I need to display  2010 03
    There is no source for  date column .
    I am using xir4 and Bex Query is the source.
    Can any body help me/
    Thanks.

    Hi,
    Try with relativedate function.
    like =relativedate((currentdate);-2) by this you will get two year back date.
    =formatdate(relativedate((currentdate);-2);"YYYYmm")
    or first get year then month by relative date function and use  concatenation.
    =formatdate(relativedate((currentdate);-2);"YYYY")
    =formatdate(relativedate((currentdate);-2);"mm")
    Thanks,
    Amit

  • Can I change the day/date format from US (month day year) to UK (date month year)?

    When I view databases through Firefox, the date/day format is set at month, day, year (US style), whereas I need day, month, year, I work in the UK and the "wrong" format is VERY confusing and could lead to errors/mistakes. IE has that format but I don't want to revert to using that.

    Gingerbread Man, thank you VERY much!! I followed your instructions and it works perfectly. I am a happy person :-))

  • Current date - 1 year in OBIEE

    Hi Friends,
    I have a  SR date column in OBIEE. Every day service requests will be submitted.  I want to put a filter on the report  every time when someone opens the report. I should always pull SR dates  between current date and  last year current date...In short, I want to see all the SR's from curret date to last year....
    Thanks
    V

    Put filter on open date as greater than or equals to timestampadd(sql_tsi_year,-1, curent_date)
    btw: what news on this?
    https://forums.oracle.com/thread/2572036
    if helps mark

  • How Do I Link To The Current Date/Month In iCal?

    I have a link on my website which points to a published iCal calendar. The link remains static, for instance, I created the link in January, and it pointed to the January view of the calendar.
    Now that its February, I'd like the link to point to the February month view (and so on throughout the year), but it remains linked to January.
    How do I make the link dynamic so that it points to the current month/date? Thanks in advance.
    G5 Dual 2.0   Mac OS X (10.4.4)  

    JFKrohn, Welcome to the discussion area!
    To get the current month, use a link like this:
    http://ical.mac.com/WebObjects/iCal.woa/wa/default?u=UserName&v=1&n=CalendarName.ics
    Where
    UserName = .Mac user name
    CalendarName = name of published calendar

  • Newbie: how to create a dynamic select list of the current date + 5 years

    Hi - I'm a JSP newbie (coming from a PHP background), and am trying to create a select list that contains the current year, plus 5 years. So, the list when generated (today), would display:
    2007
    2008
    2009
    2010
    2011
    2012
    Obviously, the code would need to generate inside the option tags, as well as in the value property of the option tag.

    function addit(){
              var val = 2012; //you can take this from js date object and strip it off
              for (var i=2007; i <= val;++i){
                   addOption(document.getElementById("mycombo"), i, i);
    function addOption(selectbox,text,value)
         var optn = document.createElement("OPTION");
         optn.text = text;
         optn.value = value;
         selectbox.options.add(optn);
    }without hardcoding:
    function addit(){
              var dd = new Date();
              var yearnow = dd.getFullYear();
              for (var i=yearnow; i <= yearnow + 5 ;++i){
                   addOption(document.getElementById("mycombo"), i, i);
    function addOption(selectbox,text,value)
         var optn = document.createElement("OPTION");
         optn.text = text;
         optn.value = value;
         selectbox.options.add(optn);
    in your jsp:
    <body onload="addit();">
    <form>
    <select name="mycombo">
    <option> Select year</option>
    </select>
    </form>
    </body>
    Message was edited by:
    skp71
    Message was edited by:
    skp71

  • How to use the API for DATE, MONTH  AND YEAR

    I would like to use the java api in .util.calender in the java api to get the date.
    How to implement the API for the "DATE","MONTH","YEAR" which are available provide by java?
    can someone give me in one complete code?

    From the Java Developers Almanac 1.4:
        Calendar cal = new GregorianCalendar();
        // Get the components of the date
        int era = cal.get(Calendar.ERA);               // 0=BC, 1=AD
        int year = cal.get(Calendar.YEAR);             // 2002
        int month = cal.get(Calendar.MONTH);           // 0=Jan, 1=Feb, ...
        int day = cal.get(Calendar.DAY_OF_MONTH);      // 1...
        int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); // 1=Sunday, 2=Monday, ...

  • Fixed report period based on current date

    I want to create a report containing records over a fixed period without using a date parameter. As a example I would like the report to continually draw on data that is no more than say ten years from the current date.
    E.g. Current date (xx/xx/2008) to (Current date - 10 years) or xx/xx/1998 then next year the formula would automatically adjust to current date (xx/xx/2009) to (Current date - 10 years) or xx/xx/1999.
    I am only a novice when it comes to designing reports so please bear that in mind.

    Hi,
    Create a RecordSelectionFormula and subtract 10 years from the current date with the DateAdd formula.
    E.g.
    //DateAdd (intervalType, nIntervals, startDateTime)
    {Table.Date} > DateAdd ("yyyy", -10, CurrentDate)
    The DateAdd function has more interval types, so you can subtract months, days, hours as well. Check the CR help file and search for DateAdd for details.
    Cheers,
    Fritz

  • E63 Current Date on Home Screen

    E63-1, 410.21.010 Nokia programmers, please enhance the home screen (I use Active home screen) by providing current date below the current time. Currently, the space below the current time is blank. It would be useful if I can see: --------------- Current Time. Current Day. Current Date-Month. Current Year. --------------- This should be in relatively big font. It would be useful if we use profiles other than the General profile. Thank you.
    E63-1 (410.21.010)
    3110c (07.21)
    Padsticker
    http://batu35.googlepages.com/index.html
    Pimlical
    http://www.pimlicosoftware.com

    Some power savers show the date as well as the time.

  • Maybe you are looking for

    • SAP 8.8 Crystal Report layout templates

      I have installed SAP 8.8 this is working fine apart from one thing i don't understand..  maybe i am just being stupid.. But there are no Crystal report layouts in the system.  Do we have to download these.. surely we don't have to write them all from

    • Trying to edit contacts freezes program

      I installed PSE8 a few weeks ago and was having a problem sending emails.  I've since changed my internet provider and have a new email address and email provider, gmail (not by choice).  I went back to PSE8 and tried to edit my contacts but every ti

    • Tar extract file in particular directory excluding path stored in tar file

      In winzip you have chk box 'Use Foldername', if you uncheck it, all files will be extracted to path given in Extract to: Like winzip, do you have facility to extract files from tar file to a particular directory ignoring path stored in tar file. os -

    • I lost my passcode. now my ipod is disable .  How can i reset it.

      I lost my passcode. now my ipod is disable .  How can i reset it.

    • Transport Business Content

      After a successfull BC implementantion, we are doing the transports and tests. However when we tried to load data from 0CO_OM_CCA_1 we get a dump saying that Function module "CO001_BIW_PARTNER_DECODE" not found. It looks like we need to include this