Convert XMP Date and Time

Hi, in my script I am trying to read the Date and Time using the XMP functions of a selected file in bridge.  Then, I want to convert that date and time into a format that looks like: "01/12/10 | 01:23 PM" and write that to another metadata field like the description.  Im stuck on trying to convert the date and time into what I want it to look like?  Can anyone help, thanks!
Here is the part of the code I'm having trouble with:
When I read the dateTimeOriginal property of the file, it is in an unfriendly format.  It looks odd and shows the time zone.  The commented lines is code that I have tried, but didn't work.  I was trying to convert the XMPDateTime object into a Date object so I can adjust the format, but I haven't been successful.
var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);      
      var myXmp = myXmpFile.getXMP();   
      var Name = myXmp.getProperty(XMPConst.NS_EXIF, "DateTimeOriginal");
      var date = new XMPDateTime(new Date(Name));
      var date2 = new Date(date);
      //dateFormat.masks.portfolioDate = 'mm/dd/yy "|" hh:MM TT';
//date.format("portfolioDate");
//date2.format("mm/dd/yy");
alert(date2.toString());
Name.convertToLocalTime();
Name.toString();
alert(Name);

Thanks for helping me out Paul.  I just have one more small problem.  I am trying to access the Headline XMP property, and I know i need to use the IPTC Core property, but it doesn't seem to work.  Here is my current code, can you help me out?
var selectedFile = thumb.spec;   
var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);      
var myXmp = myXmpFile.getXMP();   
var xmpString = myXmp.getProperty(XMPConst.NS_EXIF, "DateTimeOriginal").toString();
            alert(xmpString);
var xmpString2 = myXmp.getProperty(XMPConst.NS_IPTC_CORE, "Headline").toString();
alert(xmpString2);
var dat =xmpString.match(/(\d+).(\d+).(\d+).(\d+).(\d+).(\d+)/);
var amOrPm = "AM";
var hours = Number(dat[4]);
if (hours > 11) amOrPm = "PM";
if (hours > 12) hours = hours - 12;
if (hours > 11) amOrPm = "PM";
if (hours < 10) hours = '0' + hours;
var dateString = dat[2]+"/"+dat[3]+"/"+dat[1].substr (2) +" | "+ hours +':'+dat[5]+ ' ' +amOrPm;

Similar Messages

  • Convert Local Date and Time into GMT

    In Oracle how to convert date & time in GMT. Suppose the input will be local date & time e.g. ‘IN’, ‘15/11/2010 15:20:30’ ( country Code, DD/MM/YYYY Hr:Min:Sec in 24hr format) output should be in GMT format.

    I don't think this should be in the OLAP subforum. At least try to look for the correct section before posting next time.
    Apart from that, you can try a combination of the From_Tz and Tz_Offset functions.
    http://www.techonthenet.com/oracle/functions/from_tz.php
    http://www.techonthenet.com/oracle/functions/tz_offset.php
    I hope it helps.
    Joan

  • Date and Time convertion in iChart

    Hi,
    My question is: The date and time field displayed in ichart is in a number format rather than a date and time format. Why?
    1. A query is created first to extract data from an oracle database. The date and time is converted to a string by using to_char(x, ‘yyyy-MM-dd, hh24:mi:ss) function.
    2. An Axcute transaction is then used to convert date and time from the first query to XML date format: As suggested by Martin Auer on Aug 22, 2006 in his answer to Sudha, I create an output document in Business Logic Editor and define a column in DateTime format. The output from xAcute is in XML date format as ‘2006-12-14T13:21:00’.
    3. The second query is created to display data for the Axcute transaction. The output from the second query in Text/xml type is shown as: <TIME>2006-12-14T13:21:00</TIME>
    4. However, when the date and time is displayed in iChart, the date and time on X-axis is presented as a number like 1.166.098.860.000,00. The data source for the chart is shown as: 2006-12-14 13:21:00
    5. The display template is derived from a template used on the training course and date format in template is set to yyyy-MM-dd HH:mm:ss. The template is tested on the data from PlasticResin database (training course), the date and time is presented in a correct format.
    Could someone please answer my question?
    Thanks,
    Xin

    Xin,
    If you test your query (I assume it is an Xacute query) and choose text/xml - what is the SQL data type for the date/time column?
    It sound like the chart is not recognizing the query as a time-sensitive query.
    Let me know what you find,
    Joe Montagna

  • Function module to convert date and time

    Hi ,
    Requirment is i want to create a file in the application server.So the file name should be in the following format.
    0XX-XXXX-YYYYMMDDHH.format.
    in this HH-hours.I need to take current date and time.so is there any function module to convert into this format.If it is not there how to create file name in this format.
    Thanks,
    MR

    REPORT  ZTEST_CONV.
    data:  time_stamp TYPE timestampl.
    GET TIME STAMP FIELD time_stamp.
    You can try with GET TIME STAMP
    But it will be in Different format.

  • "Adjust Date and Time..." will convert your TIFFs to JPGs!!!

    I wanted to let everyone know of a serious bug that I've been discussing in the following thread: [http://discussions.apple.com/thread.jspa?threadID=1315705&tstart=0].
    Here's the bug. If you use the "Adjust Date and Time..." function on a TIFF file, and have iPhoto modify the original file, iPhoto will make the time adjustment, but it will *save a JPEG over your original TIFF, with the original .TIF name!!!*
    Big nasty bug. After you do this function, you have lost all that lossless TIFF data since your pictures was overwritten by a lossy JPG!
    nathan

    nathan:
    What type of edit were you making. Have been trying to duplicate that and cannot. I've changed the date and selected the original file to be changed also. Then I edited the file by cropping, changing the exposure and shadows and saving. Both versions are still tiff files.
    Now these are tiff files that I converted over from jpgs with Photoshop as my camera doesn't take tiffs. Don't know if that will make any difference.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Convert XML string into an abap format date and time

    Hi,
    Does anyone know of a method or a function module in ABAP which converts XML string into an abap format date and time.
    Here is a part of the xml that I want to convert.
    <ns2:EventDateTime>2009-07-02T10:13:45+10:00</ns2:EventDateTime>
    <ns2:EventMessageTransmissionDateTime>2009-07-02T10:13:45.987+10:00</ns2:EventMessageTransmissionDateTime>
    Currently EventDateTime and EventMessageTransmissionDateTime are type XSDDATETIME_Z and these are converted to proper dates and times. We will be changing these fields to a STRING instead of XSDDATETIME_Z. The reason for this is to make the field more versatile. The customer would be receiving dates with Zulu (2009-09-23T12:00:00Z), with offsets (2009-09-23T12:00:00+10:00/-10:00) and just local timestamp (2009-09-23T12:00:00). With this, we need to make the date fields as string
    to be able to accept the various date formats (esp. the local timestamp).
    I am looking for a standard function module or method that will convert the xml string to a proper date and time abap format.
    Would appreciate anyone's help!
    Thanks.
    Edited by: eunice ocson on Jul 13, 2009 1:49 AM
    Edited by: eunice ocson on Jul 13, 2009 1:50 AM
    Edited by: eunice ocson on Jul 13, 2009 1:51 AM
    Edited by: eunice ocson on Jul 13, 2009 1:51 AM

    Hi Eunice
    Use the FM 'SMUM_XML_PARSE'
    for more info
    [Convert XML string to ABAP|XML String to ABAP or GUI]
    hope it helps you.
    Thanks!!

  • Converting zulu format to date and time format

    I want to convert zulu format to regular dateand time format. so for e.g I have this date and time in my table
    021731ZJUN06, I want to convert it to 2006-06-02 17:31:00
    I wrote this in sql server, but don't know how to do this in oracle
    ALTER function [dbo].[ZULUToDateTime](@initDate varchar(20))
    RETURNS datetime
    AS
    BEGIN
    DECLARE @NewDate datetime
    SET @NewDate = NULL
    IF @initDate <> 'false'
    BEGIN
         SET @NewDate=     CONVERT(datetime,LEFT(@initDate,2)+ ' ' + STUFF(right(@initDate,5),4,0,' ') + ' ' +STUFF(SUBSTRING(@initDate,3,4),3,0,':'),121)  
    END
    RETURN @NewDate
    END

    Like this?
    SQL> select to_date('021731ZJUN06', 'ddhh24mi"z"monrr')
      2  from dual;
    TO_DATE('021731ZJUN0
    02-jun-2006 17:31:00Gotta love Oracle's date formatting fuctions :-)
    The format above is my default session format, if you explicitly want the format you showed, you need an extra to_char like:
    SQL> select TO_CHAR(to_date('021731ZJUN06', 'ddhh24mi"z"monrr'), 'yyyy-mm-dd hh24:mi:ss')
      2  from dual;
    TO_CHAR(TO_DATE('021
    2006-06-02 17:31:00John
    Edited by: John Spencer on Nov 10, 2011 1:45 PM
    Added correct output format.

  • Help with converting hex to date and time

    Hi!
    I am using snmp4j libraries to walk the mib tree. The system date is getting returned in 11 hexadecimal octets. I require help in converting it to date and time. I looked up the RFC convention of what each octets represent. Require help with conversion.
    Eg: 07:db:06:0a:29:1d:00:2b:05:1e
    Thanks,

    Octets Contents Range
    1-2 year 0..65536
    3 month 1..12
    4 day 1..31
    5 hour 0..23
    6 minutes 0..59
    7 seconds 0..60
    (use 60 for leap-second)
    8 deci-seconds 0..9
    9 direction from UTC '+' / '-'
    10 hours from UTC 0..13
    11 minutes from UTC 0..59
    For example I just took the time an hour ago it came out as
    07:db:06:13:12:11:1a:00:2b:05:1e
    I have to convert this as a date long value to send it.
    Do I have to write an utility of my own to do it?

  • Convert this number (2454664,29112) to Date and Time.

    Hi,
    I want to convert this number (2454664,29112) to Date and Time.
    I wrote the query :
    select to_date(2454664,'J')+ numtodsinterval(29112,'second') from dual
    It give the results 16/07/2008 08:05:12
    but the correct results is 15/07/2008 08:05:12
    Is it correct?
    Please help me.

    Don't know whether the result is correct or not, but has select to_char(sysdate,'J') from dual to do anything with it?
    Regards
    Etbin
    to be more specific
    select to_char(now,'J') || ',' || to_char(now,'sssss') the_number
      from (select sysdate now from dual)Message was edited by:
    Etbin

  • Unable to insert date and time when using date datatype

    Hi
    I am hitting a bit of a problem when using the date datatype. When trying to save a row to the table where the field it throws an error ora 01830 and complains about converting the date format picture ends...etc. Now when I do the insert, I use the to_date function with the format of "dd-mon-yyyy hh24:mi:ss". Of course, when I remove the time element, everything is perfect.
    Checking sysdate, I noticed that the time element wasn't be displayed, and I used alter session set nls_date_format to set the date and time I want to save to the table, which worked!
    Then based on advice in a previous thread to permanently fix the problem, I used alter system set nls_date_format ="dd-mon-yyyy hh24:mi:ss" scope=spfile; This showed that it was altered, and I can see the setting in the em. In sqlplus, I shutdown the database, and restarted with startup mount; alter database open; and then selecting sysdate, it still shows the date as dd-mon-yy, and still no time! Checking the em, and looking up the nls_date_format the setting is still shown as "dd-mon-yyyy hh24:mi:ss".
    So, my question is this - what am I doing wrong? Why can't save date and time using date in Oracle 11g?????
    Thanks

    user633278 wrote:
    Hi
    I am hitting a bit of a problem when using the date datatype. When trying to save a row to the table where the field it throws an error ora 01830 and complains about converting the date format picture ends...etc. Now when I do the insert, I use the to_date function with the format of "dd-mon-yyyy hh24:mi:ss". Of course, when I remove the time element, everything is perfect.
    Checking sysdate, I noticed that the time element wasn't be displayed, and I used alter session set nls_date_format to set the date and time I want to save to the table, which worked!
    Then based on advice in a previous thread to permanently fix the problem, I used alter system set nls_date_format ="dd-mon-yyyy hh24:mi:ss" scope=spfile; This showed that it was altered, and I can see the setting in the em. In sqlplus, I shutdown the database, and restarted with startup mount; alter database open; and then selecting sysdate, it still shows the date as dd-mon-yy, and still no time! Checking the em, and looking up the nls_date_format the setting is still shown as "dd-mon-yyyy hh24:mi:ss".
    So, my question is this - what am I doing wrong? Why can't save date and time using date in Oracle 11g?????
    ThanksYou most certainly can save the time. A DATE column, by definition stores date and time. What you describe is a presentation problem, and setting nls_date_format at the system as an init parm is the weakest of all settings as it is overridden by several other locations.
    without seeing the exact sql that produced the error (not just your description of what you think you were doing) it is impossible to say for sure.
    However, I'd suggest you read http://edstevensdba.wordpress.com/2011/04/07/nls_date_format/

  • DVD camcorder (VIDEO_TS) - preserve clip date and time

    I had asked this question on the forums a long time ago but iMovie did not seem to be supporting it reliably at the time. But since some time has passed, I wanted to check if iMovie '09 can import clips from a mini DVD (those used in camcorders to capture video directly on to DVD media) AND preserve the clip's date and time.
    What I see is that the first clip gets some date and time related to the event's date and time (perhaps the start time of the first clip?) but all the other clips which are imported, get timestamps of 1 second after that first clip's timestamp.
    These are all my home videos and in order to keep each clip short, I have had the habit of pausing after about a minute or two, resulting in MANY clips over MANY DVD's, so manually updating date and time is absolutely the last resort.
    The DVD player can see the clip date and time correctly, and so could the camcorder (I have since sold the darn thing!) so I know that information exists somewhere in the DVD, but it seems like iMovie is unable to "see" it.
    Any help would be appreciated, including programmability hints.

    Thank you for your post.  I figured out why iMovie was assigning today's date to everything that I imported.  It turns out that many of my video files did not have a real "created" date--some had no date at all and some had Wednesday, December, 1967 or 9 (I think).  iMovie defaulted today's date in both of these situations.  I took your advice and ot A Better Finder Attribute and easily converted all of the files using the option to copy the "modified date" into the "created date" attribute.  Now everything imports correctly into iMovie.

  • Function Modules for Data and Time

    Hi all,
              I need 2 function modules for date and time. when we pass current data(sy-datum) and current time (sy-uzeit) into function modules, shoud get date in <b>dd/mm/yyyy or dd.mm.yyyy</b> and time in<b> HH:MM:SS</b> formats.
    Thanks in advance

    Hi Ranjith,
    i think this will b usefull for you..
    SAP Bar Chart Function Modules and what they are used for
    Function module
    Used for
    BARC_GRAPHIC_PBO
    Starting bar chart at PBO time, using a graphic profile (parameter PROFILE)
    BARC_GRAPHIC_PAI
    Analyzing data returned by the graphic
    BARC_SET_TIME_AXIS
    Setting start and end of time axis
    BARC_SET_OPTIONS
    Setting options
    BARC_ADD_CHART
    Creating a chart
    BARC_SET_CHART_ATTRIB
    Setting chart attributes
    BARC_ADD_SECTION
    Creating a section on the time axis
    BARC_SET_SECTION_ATTRIB
    Setting section attributes
    BARC_ADD_RIBBON
    Adding a ribbon to the time axis
    BARC_SET_RIBBON_ATTRIB
    Setting attributes for ribbons in the chart
    BARC_ADD_GRID
    Adding a time grid
    BARC_SET_GRID_ATTRIB
    Setting grid attributes
    BARC_ADD_LAYER
    Adding a layer (graphic elements)
    BARC_SET_LAYER_ATTRIB
    Setting layer attributes
    BARC_ADD_LINE
    Adding a line
    BARC_ADD_CALENDAR
    Creating a calendar
    BARC_SET_CALENDAR_ATTRIB
    Setting attributes for a calendar
    BARC_ADD_TIME_PROFILE
    Creating time profiles
    BARC_SET_TIME_PROFILE_ATTRIB
    Setting attributes for time profile
    BARC_ADD_INTERVAL
    Adding a time interval
    BARC_SET_INTERVAL_ATTRIB
    Setting time interval attributes
    BARC_ADD_TIME_OBJECT
    Creating a time object
    BARC_CONVERT_DATE
    Creating a date string in bar chart format
    BARC_REVERT_DATE
    Converting a date string in bar chart format to date and time
    BARC_ADD_DATELINE
    Creating a date line
    BARC_SET_DATELINE_ATTRIB
    Setting dateline attributes
    BARC_GET_PROFILE_CONTENTS
    Obtaining profile contents for customizing a chart
    BARC_GET_COLUMN_WIDTH
    Selecting new column width
    BARC_SET_COLUMN_WIDTH
    Setting the column width
    BARC_GET_TEXTINDEX
    Obtaining the text index of a field
    BARC_SET_LABELS
    Positioning the chart display
    BARC_SET_COLUMN_ATTRIB
    Setting column attributes
    BARC_SET_ROW_ATTRIB
    Setting row attributes
    BARC_SET_ROW_HEIGHT
    Setting the line height
    BARC_SET_MAXCHARTS
    Setting the maximum number of charts sent
    <b>If its usefull reward points
    </b>

  • Incrementing a string number for date and time

    There are probably a lot of ways to do this, but I only want to use a bunch of if - else loops if I really need to.
    I have a date and time for input, let's say 2006-04-19 22:00. In Java, if I convert that to 3 integers (year, month, day), it will output 2006-4-19. I need to be able to increment in a loop for every day and month from one date to the next. If I keep it as a string, I won't be able to increment the value though, (at least I'm not sure how). I'm thinking that even if I converted it to an integer and back to a string, that the leading zero would be removed.
    I found a post here that said something about formatting the number with 2 numbers, by using:
    DecimalFormat format = new DecimalFormat("00");
    format.format(1, sb, new FieldPosition(0));
    Or is there a way to use the gregorianCalendar stuff that would output the date with all of the zeros in place, while incrementing and looping correctly?
    Thanks.

    I would get a Date object--you can use java.text.SimpleDateFormat if you're starting with a String--and use that to create a GregorianCalendar. Then you can just call Calendar's add method to add one to whichever field you want. Use the SimpleDateFormat to turn the date back into a String for display again.
    Calculating Java dates: Take the time to learn how to create and use dates
    Working in Java time: Learn the basics of calculating elapsed time in Java
    Formatting a Date Using a Custom Format
    Parsing a Date Using a Custom Format

  • Insert date and time into write to spreadsheet

    Easy question here
    I need save 4 arrays of data and insert the date and time that it was taken (LV 8.6)
    for example
    9/4/09 10:00:01 AM  4  6  7  2
    9/4/09 10:00:02 AM  4  6  7  2
    9/4/09 10:00:03 AM  4  6  7  2
    9/4/09 10:00:04 AM  4  6  7  2
    Any ideas, I can't wire the timestamp or date/time string right into the create array
    Thanks
    Chris
    Solved!
    Go to Solution.

    Ok
    the basic problem that I see is the the LabVIEW TimeStamp type is a cluster.  Converting it to a dbl gives you a value in seconds elapsed since 1904 Jan 1 12:00AM GMT and, your spreadsheet cannot interprate that (or display that) as a "TIME."   So, you want to convert it to a string (easy TS->String check the help for format options) BUT, you might want to pass all of your data as numbers into your spreadsheet so you can post-calculate or graph other outputs vs. TIME!  This little chunk of code .....
     converts a LV Timestamp to a number that Excel interperates as "the amount of days elapsed since 0 Jan 1900 @ 12:00AM LOCAL."  You will need to format the cell in Excel to display it as a date-time But it can be operated on and graphed against with only Excel's limitations (Excel followed the Lotus bug of erroneously assuming 1900 was a leap year, and Leap seconds are unrecognized)
    Enjoy!
    Message Edited by Jeff Bohrer on 08-06-2009 02:28 PM
    Jeff

  • Selection Screen - Date and Time

    Hi,
    I have given a selection screen where the user needs to key in the input in the following format
    dd.mm.yyyy hh:mm:ss.
    Reason is that the database fetching these elements accepts only in this criteria.
    Now as they look into automating this program, they would want to automatically take the current system date and time - 24 hours .
    How do I achieve this in the above format? If this is not possible, let me know if i can make the selection screen with normal sap date format and convert it to the above format on passing to the select statement.
    Regards
    Sam

    Hi Sam,
    See this. Is this your requirement.
    With this we are able to get Current time-stamp to selection parameter.
    REPORT ZTEST.
    DATA: L_TS TYPE TZNTSTMPS,
           L_TS_C TYPE CHAR14.
    PARAMETERS:
    P_TMSTMP TYPE TMSTMP OBLIGATORY MEMORY ID TEST.
    INITIALIZATION.
       GET TIME STAMP FIELD L_TS.
       MOVE L_TS TO L_TS_C.
       SET PARAMETER ID  'TEST' FIELD L_TS_C.
    The output is
    Jogeswara Rao K

Maybe you are looking for

  • Bug with exporting project to java source

    Hi, This is in TopLink 9.0.4.2 (Build 040311). We're in the process of trying to determine if we should upgrade our TopLink from 2.5 to 9.0.4, and have not yet purchased a support contract because we haven't made the final decision yet, so I'm postin

  • How to change Purchase Order currency after Good receipt and Good issue?

    Hi, I've a PO created last year. The PO currency has been entered wrongly. My store colleague has been performed good received and consumed it. Now, I am not able to change PO currency to correct one, due to this message:- Currency can no longer be c

  • PDF in Chrome

    Experiencing an issue with opening a PDF doc in Chrome. I receive a dialogue box stating that I must launch Adobe and accept End User License Agreement. this has just happened in the past few weeks...PDF

  • Maintaining file structure after converting

    I'm trying to import my music collection into iTunes. My problem is that iTunes makes a directory according to artist, and then places the album inside. This is fine when an entire album has the same artist, but not good when importing sound tracks a

  • Adobe Photoshop & Illustrator CS v11.0

    Can anyone point me in the right direction for a very good tutorial session on this program?