DateTimeFormatter.format() and date stored as string

Greetings,
I need to display some data in a spark data grid and would like to format a date from that data with a labelFunction calling a DateTimeFormatter's format function.
The date is stored in my ArrayCollection in the following format '2004-05-03 01:03:52.0'
my formatter is as follows
<s:DateTimeFormatter id="dateFormatter" dateTimePattern="YYYY-MM-DD" />
I would like my label function to return something like
return "Date: " + dateFormatter.format( item[column.dataField]); // where the item[column.dataField] = "2004-05-03 01:03:52.0"
The date is coming up blank. I'm thinking I need to convert the string "2004-05-03 01:03:52.0" to a Date object first, then pass that into the format() call.
Is that the way to go? If so, what's the best way to handle that?
Thanks

Thank you Sumesh, but the problem was with getting the string converted to a date. I found a solution on
http://polygeek.com/4137_actionscript3_batbelttime-utilities
* Convert an MySQL Timestamp to an Actionscript Date
* Thanks to Pascal Brewing [email protected] for the beautiful simplicity.
public static function convertMySQLTimeStampToASDate( time:String ):Date{
var pattern:RegExp = /[: -]/g;
time = time.replace( pattern, ',' );
var timeArray:Array = time.split( ',' );
var date:Date = new Date( timeArray[0], timeArray[1]-1, timeArray[2],
timeArray[3], timeArray[4], timeArray[5] );
return date as Date;
I pass in my string and it gets converted to a Date. I then pass the Date to the DateTimeFormatter.format() and everything works as expected.
Thanks

Similar Messages

  • I like the idea of auto back-up for my new iMac, Ipad and PC Netbook, particularly if I can access all files and data stored on any device.  But I have a Conceptronic router.  Will Time Capsule work with this and how?

    I like the idea of auto back-up for my new iMac, Ipad and PC Netbook, particularly if I can access all files and data stored on any device.  But I have a Conceptronic router.
    1. Will Time Capsule work with this and how?
    2. Can my printer USB be plugged in and then shared between the devices?
    3. Can I create a network and how?
    4.  What happend when a visitor logs onto my existing wireless router?
    I'm new to Macs (well a returning user having started with Mac Plus!!) and not very technical.  Any help / advice will be much appreciated.
    Ray

    The key to what you seem to want to do is to be able to get Apple's Time Capsule router to "join" the network that your Conceptronic router.  I believe that works with some third-party routers, but I've never seen a list of those that work in such a configuration and I have no experience with Conceptronic equipment.
    You might be better off with a Network-Attached Storage (NAS) device instead of a Time Capsule.

  • List all of the existing column and there column format and data format?

    Hello Gurus,
    I am new to OBIEE and i have a requirement to verify the column format and data format for all of the existing column while generating a analysis report. Is there any way i can list down all of the columns which are exposed and list there column format and data format?
    For checking the individual column properties i know there is an option called 'Column Properties' but want to know all in once go.
    Kindly help me and thanks in advance.
    Thanks

    I don't think you have anything in answers to get that, Go to Repository and Utilities -> Generate Metadata Dictionary that will give columns and datatype.
    Award points if it helps
    ~Srix

  • List of Number format and Date format according to the Locales

    Hallo everyone.
    I am searching for a list or document which includes the number and date formats according to the country locales. Where can I find sort of document?
    Another question: Where can I find the all parameters of swing.properties file?

    "Date - allows the user to enter a date as a parameter. Note that the data type must also be "Date" and the format must be Java date format."
    Page 4-9, Adding Parameters and Lists of Values
    Oracle® Business Intelligence Publisher
    Report Designer's Guide
    Release 10.1.3.4
    Part No. E12187-01

  • Sorting the table records based on date (stored as string in the database)

    Iam storing the date as string(varchar2) in the database.
    Date format: DD-MMM-YYYY hh:mm:ss am/pm
    example: 12-MAY-1984 11:12:45 AM
    now i have to sort the records in such a way that recent records should be displayed first, then past records.
    i need help reagrding

    Step one: Select from the table
    Step two: Convert the string to a date
    Step three. Order on this converted date descending (= recenct records first)

  • Archiving of Workflow items and Data stored - Reg

    All gurus,
    I am working on ECC 6.0 with the below system:
    SAP_BASIS     700     0015     SAPKB70015     SAP Basis Component
    SAP_ABA     700     0015     SAPKA70015     Cross-Application Component
    I understand that not all the data that is available in the regular workflow log will be archived. But, I'm not able to find any information guidelines by SAP regarding what information will be saved and how this criteria of selecting the information being archived is done and where.
    Can anybody tell me if there is any information regarding the above. Coz, this information archived(including the workflow and each ste (task) container data) is being inconsistent among various workflow logs.
    So, it would be really helpful if anybody can share their experience and give some suggestions on this data storage selection.
    Thanks in advance,
    venu

    Closing the thread due to no response.

  • Converting Date-Time to Long Date in a string that is stored in a formula

    The following are 2 verions of formulas that I've tried in placing the long date on a report.  I want the JUD_T_MEETING_NOTICE.MEETING_DATE to be displayed on the letter if Outcome_ID = 3.00 as April 29, 2009.  The field's fomat in the table is 04/29/2009 and neither of the formula's below worked.  I tried formatting the date as a separte formula, as shown in Formula #2 below, but the formatting defaults to the original DataType.  Anyone have any ideas on how to format the date within the string in the formula?
    FORMULA #1:
    IF {JUD_T_MEETING_NOTICE.FK_OUTCOME_ID} = 3.00
    THEN 'I received the enclosed report(s) for review.  To resolve this matter, you must contact the office at ' & {@HallPhone} & ' to schedule a meeting to discuss the incident with me.  This meeting must occur by ' & DATETIMETODATE({JUD_T_MEETING_NOTICE.MEETING_DATE}) & '.  If you have a conflict with this deadline, please let me know as soon as possible to make alternative meeting arrangements.'
    ELSE IF {JUD_T_MEETING_NOTICE.FK_OUTCOME_ID} = 9.00
    THEN 'You missed your scheduled meeting.'
    FORMULA #2:
    IF {JUD_T_MEETING_NOTICE.FK_OUTCOME_ID} = 3.00
    THEN 'I received the enclosed report(s) for review.  To resolve this matter, you must contact the office at ' & {@HallPhone} & ' to schedule a meeting to discuss the incident with me.  This meeting must occur by ' & ({@FormatMeetingDate}) & '.  If you have a conflict with this deadline, please let me know as soon as possible to make alternative meeting arrangements.'
    ELSE IF {JUD_T_MEETING_NOTICE.FK_OUTCOME_ID} = 9.00
    THEN 'You missed your scheduled meeting.'

    Assuming JUD_T_MEETING_NOTICE.MEETING_DATE is a date field, modify your formula to:
    totext(({JUD_T_MEETING_NOTICE.MEETING_DATE}),"MMMM dd, yyyy")
    If it is not a date field but a string, then
    totext(cdate(JUD_T_MEETING_NOTICE.MEETING_DATE ),"MMMM dd, yyyy")

  • How long charactors can stored in 'STRING' type?

    HI
    I'm just curious how long charactors can stored in 'string' type.
    and if there is limit number to store what kind of type is unlimited length type?
    and is it possible send a parameter page to page with 'form'  'post' way unlimited length of string?
    and is there any type of DB field which is save last number of records  automatically when one record is inserted like MANDT?
    MANDT is client number though.
    Regards.

    Here is what ABAP key word documentation says about string
    The elementary data type STRING is similar to data type C and refers to a variable-length string. Accordingly, the elementary data type XSTRING is similar to data type X and refers to a variable-length byte sequence.
    In contrast to a C or X field, the length of a string is not static but variable and adjusts itself to the current field content at runtime. Dynamic memory management is used internally. Strings can have any length.
    The initial value of a string is an empty string with length 0. A structure containing a string is seen as deep. A deep structure cannot be used like a C field. Strings can be displayed in the ABAP Debugger and used in the ABAP Dictionary.
    It is not yet possible to use strings in screens or database tables. However, strings can be stored in database tables as clusters using EXPORT and transferred using IMPORT.
    As far as I know the limit is 4 Giga Byte which equals more or less no limit. I donnot expect that you will meet this limit in practice. Its very likely that will run out of memory before you reach this limit.
    In short there is no limit to the data stored in STRING var but the system memory has a limit....
    This can be proved with the below program:
    For the program system dumps with mess.
    "Unable to fulfil request for 127683972 bytes of memory space. "
    here's the test prog.:
    TABLES ekko.
    DATA testmax TYPE string.
    DATA z(16) TYPE i.
    SELECT * FROM ekko.
      CONCATENATE testmax ekko INTO testmax.
      z = strlen( testmax ).
      IF  z = 63841496.
        BREAK-POINT.
      ENDIF.
    ENDSELECT.

  • Format "shot date (yyy mm dd) + custom name"

    While creating subfolders with de advanced photo downloader from my camera i want to use the format "shot date (yyy mm dd) + custom name". This format seems not available in the Dutch version of the program. The format should be available as it seems in the "Adobe Photoshop Elements 11 - Classroom in a book".
    How to organize my format?
    Fons

    If you have a string like 2008-12-15 and you want to interpret it as a date and format it as 12/15/2008, then you need two DateFormat objects.
    One to parse the String in the first format into a Date, -------> i could do this
    try {
              String begin_date = "2008-12-15";
              System.out.println("The begin date is :"+begin_date);
              DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
              Date d1 =  df.parse(begin_date);
              System.out.println("the Date value is d1 :"+d1);
    catch() {
    }Output is :The begin date is :2008-12-15
    the Date value is d1 :Mon Dec 15 00:00:00 EST 2008
    Pls help me with the second part :- ?????/
    and one to format that Date into a String in the second format. MM/dd/yyyy --- how to do this ..after i tried several times with different statements , i am asking this piece of code to achieve this

  • How to calculate elapsed time(including time and date)?

    Hi all,
    I want to realize a function that can calculate the elapsed time which include time and date.Below is my thought:get the current time and date and store it to a .txt file then using the latest time and date subtract the time and date stored in the .txt file.how can realize it using the simplest way?I'm using LV7.1.

    Hi Idragon,
    you can do it like this.
    Mike
    Attachments:
    DateTime.PNG ‏12 KB

  • Waveburner : Time Format and Track start marker insertion ?

    Hi,
    I am exporting the Markers from a Final Cut Pro project to get their position.
    I copy/paste this time code in a Track start marker in Waveburner to set it in the right position.
    The problem is that in Final Cut Pro the time is set in HH:MM:SS:Fps  (Frames per seconds (25 fps in my PAL project)
    And in CD tracks window (sorry I am translating from a French user interface) it's not the same time format : CDDA frame (1/75th of a second)...
    so the track position is approximative (less than 1 second)
    I have selected the right time unit in the Wave View : Min:Sec:Im (25fps)
    In preferences I checked "Set Time Format Globally checkbox"
    But it's still in CDDA when I insert  a track marker...
    How could I manage that ?
    Thanks for your help
    Eric

    Seems there is no edit button here.
    After having another go at this problem, I think I have found a better solution that solves both formatting and date entry problem. The only downside is that you'll need to make 5 columns for a single date rather than 1.
    Step 1.
    For each date entry, create the following columns:
    | FormattedDate | NumbersDate | Day | Month | Year |
    FormattedDate is the final date displayed according to our format.
    NumbersDate is the internal Numbers date representation.
    Day, Month, Year columns are the ones you use for data entry.
    Step 2.
    Create/convert our 3 columns date (Day, Month, Year) into Numbers internal date.
    So, in NumbersDate column, insert this formula:
    NumbersDate: =DATE(Year, Month, Day)
    Step 3.
    Apply our own formatting for the date output display. In this example, I want an output in the form of Dayname, Day Month Year (Saturday, 24 September 2011).
    FormattedDate: =DAYNAME(NumbersDate) &amp; ", " &amp; (Day) &amp; " " &amp; MONTHNAME(Month) &amp; " " &amp; (Year)
    This way, changing the raw date input is as simple as changing the respective column. If any discrepancy between entered and displayed data exist, it is easily spotted by comparing between the raw date columns and the formatted output.
    Another advantage is reducing the risk of data corruption to the date, since the date is now simply represented as integer values in their respective columns.

  • Convert String to Date and Format the Date Expression in SSRS

    Hi,
    I have a parameter used to select a month and year  string that looks like:    jun-2013
    I can convert it to a date, but what I want to do is,  when a user selects a particular month-year  (let's say "jun-2013")
    I  populate one text box with the date the user selected , and (the challenge Im having is)  I want to populate a text box next to the first text box with the month-year  2 months ahead.    So if the user selects 
    jun-2013   textbox A will show  jun-2013 
    and textbox B will show  aug-2013..
    I have tried:
    =Format(Format(CDate(Parameters!month.Value  ),  
    "MM-YYYY"  )+ 2  )   -- But this gives an error
    This returns the month in number format   like "8"    for august...
    =Format(Format(CDate(Parameters!month.Value  ), 
    "MM"  )+ 2  )
    What is the proper syntax to give me the result    in this format =  "aug-2013"  ???
    Thanks in advance.
    MC
    M Collier

    You can convert a string that represents a date to a date object using the util.scand JavaScript method, and then format a date object to a string representation using the util.printd method. For more information, see:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html
    In your case, the code would be something like:
    var sDate = "2013-01-10";
    // Convert string to date
    var oDate = util.scand("yyyy-mm-dd", sDate);
    // Convert date to new string
    var sDate2 = util.printd("mm/dd/yyyy", oDate);
    // Set a field value
    getField("date2").value = sDate2;
    The exact code you'd use depends on where you place the script and where you're getting the original date string, but this should get you started.

  • HT1320 how can i save me data stored on a non responding ipod classic and says you need to format before using it?

    how can i save me data stored on a non responding ipod classic and says you need to format before using it?
    in another way : how can i save my date stored on my classic iPOD as a external hard .... when that msgs appears .... volume doesn't contain a recognized file system , make sure the file system is loaded .... then , you need to format ??? can anyone help ?

    It sounds like the iPod's storage has data corruption.  You may be able to treat it like an external drive and use data recovery software on it, but it probably won't work because the system is telling you that the drive needs to be formatted before it is recognized.
    If the problem is data corruption and there is no hardware-related problem on the iPod's hard drive, a Restore should fix the problem.  But this will obviously erase the iPod's hard drive.

  • How do I format a date string in ISO 8601 format?

    Post Author: Perth
    CA Forum: Formula
    I am using a SaaS application, and uploading Crystal XI report templates to run using the application's reporting page. My custom date fields are stored using the ISO date format, and are made available as text strings in the form "yyyy-mm-ddThh:mm:ss" eg. "2007-10-09T00:00:00". The SaaS vendor say use a Crystal function. I have tried CDATE, DATEVALUE etc but these don't recognise the format as a valid date. I want to display this date as dd mmm yyyy.  Any ideas?

    Post Author: Perth
    CA Forum: Formula
    I have found a solution from another forum and post it here to close this off.
    It requires defining a "Report custom function". Use the formula workshop to create a function, giving it a name. Then paste this:
    Function  (stringVar v1)Date (ToNumber (Left (v1,4 )),      ToNumber (Mid (v1, 6,2 )) ,      ToNumber (Mid (v1, 9,2 )) )
    I can now format this date in the normal way as it is a date!

  • Not able to convert string attribute to number and date please help me out

    not able to convert string attribute to number and date attribute. While using string to date conversion it shows result as failure.As I am reading from a text file. please help me out

    Hi,
    You need to provide an example value that's failing and the date formats in the reference data you're using. It's more than likely you don't have the correct format in your ref data.
    regards,
    Nick

Maybe you are looking for