How to convert a hex date?

I notice with the release of SharePoint Foundation 2010 metadata using cfsharepoint dates/times are converted in the following format: 0x01cf2d81. 0x71c80a00

How to convert it to a regular date using ColdFusion?  I found a few references to this question here http://sharepoint.stackexchange.com/questions/66602/dates-and-times-in-properties-vs-field s/91069 #91069 which shows a solution like this:

//fieldValue looks like "0x01cf2f8e|0x6e559e00"
string fieldValue = listItem.Properties[dateFieldName]
string hexValue = fieldValue.Replace("|", "").Replace("0x", "");
long ticks = long.Parse(hexvalue, NumberStyles.HexNumber);

DateTime date1 = DateTime.FromBinary(ticks).AddYears(1600);

But I have no idea how to do that in ColdFusion.  Apparently, the hexadecimal value represents the number of ticks since January 1, 1600.  Crazy, I know.

Any ideas?  Thank you.

Thanks for your help in this, Alexander.  I have worked on this for a day and discovered some useful information and finally found an easier way to do this.

Below, you will see that the number of ticks can actually be retrieved using the method of parseLong() of Java.  I don't know what is happening with inputBaseN or why it does not work for this scenario, but we cannot forget that for now.  Also, I discovered Windows time system does not start at 1600, he begins to 1601.  The guy in the article I linked to really wrong, so apologies for any confusion on that!  Finally, I convert the date in local time.

Here's the complete code to convert the hexagonal date of SharePoint at regular date using ColdFusion.  Hope this helps someone in a similar situation.

  
  
  
  
  
  
  
  
  

By the way, here's a cool article about a guy who goes to something similar: http://ruthsarian.wordpress.com/category/programming/coldfusion/

Tags: ColdFusion

Similar Questions

  • How to convert to format Date in milliseconds

    Hi all

    I am getting the output of a variable in milliseconds format, how can I convert it in date format

    For ex: I get variable input like 1366664691000 and I need to convert it to April 22, 2013 23:04:51 CEST (or SOA form). is there any function for this in XSL or XPath?

    Thank you

    Hello

    My XSLT works now after making a few changes

    and included namespace xmlns:fn = "http://www.w3.org/2005/xpath-functions.

    Now, I'm successfully number of days. My use case is to delete the files of the bases on the number of days. (i.e. changed the time - current date).

    Once again thank you @ vladidos

  • How to convert String to Date

    hell there everyone,

    I have a question which is:

    How to convert a string that we get by reading an XML in the instance of date value type?

    So there is a XML that modifiedDate as an attribute on a node of the XML and how I put this value in an instance variable date?

    the timeformat in the XML file is: mm/dd/yyyy hh: mm: = > 31/12/2010 23:57:46

    I chose this time format because I want to use the method . parse() which always causes an error, but that's another topic...,.

    hope I was clear on the issue,

    Thanks in advance for the help.

    First of all, you should watch the Date object constructor to find out how to specify different parameters.

    public void Date (yearOrTimevalue:Object, month:number, date:number = 1, hour:number = 0, minute:number = 0, second:number = 0, millisecond:number = 0)

    Then you need to determne how to break the string by using the String.Split method.  The first split() should be the space between the date and time, the second for the slashes in the date and the third for the colon in time.

    Then you come to take each of these paintings of substrings and feed them in the constructor as the Number() values.

    If you remain unsure how to do this, look at the different terms that I have identified in the help documents and you will find them all explained with examples.

  • How to convert varchar to date datatype all insert or update in the table

    Hai All

    I need to convert to varchar type to date.

    I have two Tables T1, T2

    Structure of T1

    Code varchar

    Time varchar

    Date varchar

    Structure of T2

    Var EmpName

    Empcode var

    Date of the respondent

    Outtime date

    Intrinsically date

    Date of Introut

    Att_date

    Now I need to spend the time form T1 to T2 respondent, outtime, intrinsically, introut under certain conditions

    So now I need to convert Varchar to Date so that the insert or update

    I tried something

    Insert into T1 (code, respondent, att_date) values

    (To_date(Date|| dele de code temps, «hh24mi de mon-dd-yyyy»), att_date);

    OR update while

    Setting a day set Outtime T2 = To_date(Date||) Time, 'hh24mi mon-dd-yyyy') where...


    I got an error Ora-01861


    Concerning

    Srikkanth.M

    You did not show an example of your date or time values, control may be necessary to add a space between them, like

    To_date(Date || ' ' || time,'dd-mon-yyyy hh24mi')
    
  • How to convert a xs: date for XS: DateTime

    In my application, there are the following 2 cases, I need to manage:

    1. I have a "XS: date" and I need to convert it in "XS: DateTime".
    2. I have a "XS: date" and a "XS: Time" and I need to combine in ' XS: DateTime.

    Following the answer to this question on Stackoverflow, I tried both " xs:dateTime($date) "and" fn:dateTime($date, $time) " but none of them worked.

    When I used " xs:dateTime($date) " to manage the 1st case, I got the following exception during the OSB has reached the stage of conversion for the date:

    OSB Replace action failed updating variable "body": Error parsing XML: {err}XP0021: "2014-12-09": can not cast to {http://www.w3.org/2001/XMLSchema}dateTime: error: date: Invalid date value: wrong type: 2014-12-09

    When I used " fn:dateTime($date, $time) ", the transformation is not yet accepted by the IDE. " It displays the following error:

    line 113, column 42: "{http://www.w3.org/2004/07/xpath-functions}dateTime" unknown function (or number of arguments (2) is wrong

    For now, as a solution, I use 'concat' to combine the date and time fields in the 2nd case and add 'T00:00:00' to handle case 1, but I think that this is not a good approach.

    I would be very grateful if you could show me how I can correctly convert date in dateTime format fields.

    For the moment, I use OSB 11 g with the last v11.1.1.7.4 grouped patch applied.

    Found in the documentation that, in fact, only the working paper 2004-07 is implemented in this version:

    https://docs.Oracle.com/CD/E28280_01/admin.1111/e15867/XQuery.htm#OSBAG444

    According to the specifications, the casting of XS: date for XS: DateTime should work:

    XQuery 1.0 and XPath 2.0 functions and operators

    But as I mentioned previously, it is perhaps that you do not pass the correct data type.

    If the data are not based on a schema, then sch:jdOriginalPromisedDeliveryDate will be considered from type xdt: untypedAtomic and cannot be cast in all except XS: String.

    Is - it works better:

    {xs: date ($jdOriginalPromisedDeliveryDate) cast as xs: DateTime}

    ?

  • How to convert number in date and time in labview

    Hi all

    I have a hexadecimal string and converted into a number. Now this number to display in the format of timestamp. Uses the format of the time Unix.

    By using this link, I can convert this number to timestamp.  http://www.UnixTimeStamp.com/index.php

    But how it should be done in LabVIEW? I know it may be simple, but please help.

    I enclose my VI for referance.

    Thank you

    Manisha

    Hi Man_Can,

    You can add the origin of UNIX timestamp to your number:

  • convert the varchar2 data type to the data number type

    How to convert the varchar2 data type to the data type number.


    It looks like my data

    create table one)
    col1 varchar2 (50)
    col2 varchar2 (500);

    Insert in a (col1, col2) values ('1234 ', ' 2345');

    Select Column1 of number (19)) cast (to_number (col1);

    IAM getting error invalid number


    I need to create a table with the same columns with data like number types (19)

    can someone help me

    Thank you

    You have changed your original post, so now I see that you get the invalid number.

    This is why you should always avoid the varchar columns to store numbers or dates...

    Since your table source contains a nonnumeric value, you can write a pl/sql to convert data and see what records are false:

    SQL> insert into a (col1,col2) values ('xxxx','2345');
    
    1 row created.
    
    SQL> select * from a;
    
    COL1     COL2
    -------- --------
    1234     2345
    xxxx     2345
    
    2 rows selected.
    
    SQL> create table b (col1 number(19), col2 number(19));
    
    Table created.
    
    SQL> set serverout on
    
    SQL> declare
      2  cursor c is
      3  select * from a;
      4  begin
      5    for r in c loop
      6     begin
      7       insert into b values (to_number(r.col1), to_number(r.col2));
      8     exception
      9       when invalid_number then
     10        dbms_output.put_line('Row rejected: col1='||r.col1||' col2='||r.col2);
     11     end;
     12    end loop;
     13  end;
     14  /
    Row rejected: col1=xxxx col2=2345
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from b;
    
          COL1       COL2
    ---------- ----------
          1234       2345
    
    1 row selected.
    

    Max

    Published by: Massimo Ruocchio, June 14, 2011 20:00
    Added the first query in the example

  • How to convert hex 8 bytes floating point double?

    Hello

    I want to know how to convert a string of 8 bytes of data double floating-point.

    data (HEX): 40 02 70 40 00 00 00 4F

    Thank you.

    DP

    This string of 8 bytes of data is actually a string? Are the characters in the string of letters or you have hex values? Ultimately you want to use the Type Cast:

  • How to convert the Ascii string containing hex to hex string info?

    Dear all,

    I am busy doing a control/reading program for pumps of ISCO.

    Right now I'm in trouble with to send orders for PUMPS in HEXADECIMAL. When I use a CONTROL to the STRING in HEX display, everything works fine (when I manually write down the command in the control of the chain).

    Exist it a couple of pieces order: string Destination, length, ordering, Checksum. I'm doing a sup - screw that automatically calculates the checksum (modulo 256) and adds it to the string. Everything is going well: first of all, I shared the ascii bytes command and I calculate the checksum and add as ASCII HEXADECIMAL value to the chain of command. Also a CR (= 0d) is added. Now the whole string must be converted to hex. The string contains the right nummers HEX, but they are in ASCII format. Here was I feel worth it, I don't know how to do it!

    So to summarize:

    I have an ascii string that contains the values HEX (for example 315230303652454D4F544531420D) and it must be converted to a HEX string (for instance 3152 3030 3652 454 4531 420 4F54) for the pump of the ISCO can understand the command.

    The VI is attached.

    Thank you in advance,

    Bio

    Bio,.

    This should do what you want.

  • How to convert power into binary data values

    Hey.

    I need to build a VI that I input to a power (from 0 to 300 W) value and then convert that value to a 12-bit binary value, should be sent to DAC from my electronics and control power.

    I was reading things about numbers fixed-point, but has not come to firm conclusions.

    Since I have 4095 numbers in a 12-bit value, I can have a precision of 0,07326 in my controls.

    To sum up, when I run my minimum value (0 W) I want a bytes 0000-0000-0000;

    When I throw my maximum value (300 W) I want a byte 1111-1111-1111.

    Guys please help me about what are the tools I use to build this?

    Thank you!

    pedroseger wrote:

    I'm pretty new to labview, so I'm sorry for the basic response, but this scale you are talking about: How do we? Properties-> data entry?

    You don't say what kind of data is that the instrument. Here are some possibilities showing the scaling.

  • How to convert an array of string elements to a cluster with elements named different data types?

    I'm looking for more help with the conversion of an array of elements of the chain in a cluster containing elements named different data types.

    I am importing data from an Excel worksheet.  He is coming in LabVIEW as separate (channels) 3 tables: 1) Variable name, (2) three possibilities Int, double, String) data type and the value 3), with the clues in each table corresponding to a separate variable (I have about 180 variables to import).  My ultimate goal is to convert the string array of 'Value' in a cluster.  But I want the correct data type in the cluster and I also the elements of the cluster name to match with the string 'Variable name' table so that I can use the Unbundle based on the name in my main VI.

    Please see attachment a Subvi for more details.  I did the size of the new items of tables 5 for simplicity.   I realize that labels property cannot be changed during execution and I don't think I need to do.  I just want to use the production cluster (mainly the unbundle by name) to help design my main VI.  I will need to 'read' and 'write for' the cluster during execution, but I won't need to change the names of the items.

    I was also wondering if there is a better way to import data from Excel?  Is it possible to import directly into a cluster immediately rather than put everything as strings?  I have attached a Subvi showing how I currently bring in data (found on the forum somewhere).  It comes as table 2D, which I divided into 3 separate tables that I mention above.

    I am open to any suggestion.  Thank you very much.

    -Mike

    Instead of trying to create a cluster, I think I would use only variant attributes.

  • How to convert binary data from the Panel controls in ASCII values?

    Hello

    I seemed to face a roadblock with how to convert binary values in ascii.

    I created this .vi to save all control values in an .ini file and call them at that time where I will carry out the .vi as shown in the file attached. Registration key to simply save the data and Cancel button discards all current changes.

    I would like to understand how to retrieve all the values of control to ASCII, so I assign to a global variable for later use. I've looked everywhere for a good reference document, and I couldn't find one that would explain my question. I would be greatly appreciated if someone could point me in the right direction.

    Thank you

    Sam

    I tried a simple way to save control values in the front panel

    Not reinventing the wheel, when there are ready to use of solutions, for example:

    http://sine.NI.com/NIPs/CDs/view/p/lang/en/NID/209753

    Use the MGI save & restore settings VI of the palette (for example, it records all the settings that have been changed in a graph, which is very useful) and the MGI Save (restoration) Front Panel data live (to save and restore control values in the front panel).

    Here is an example:

  • How to convert a table 1 d of cluster of 5 items in a table of numbers 2D? (a graph historical data)

    Hello

    in my vi, I have an array with 5 slots displaying measurement data.

    The user must be able to record all the data in the history of the card at any time. (for example the user looks at the picture and something happens, then it based on a 'save' - button)

    I know that I can read the data in the history with a property node. This isn't the problem. The problem is, how to deal with the data? The type of history data is a table 1 d of cluster of 5 elements.

    I convert these data somehow in a 2 D-table of numbers or strings, so that I can easily save it to a text file.

    How to convert a table 1 d of cluster of 5 items in a table of numbers 2D?

    I use LabVIEW 7.1

    Johannes

    Hallo Johannes,

    the photo shows the trivial way:

  • How to convert the date in milliseconds?

    Hi all

    Can I know how to convert the date in milliseconds?

    My current datetime like this Formate

    QDateTime::currentDateTime (m:System.NET.SocketAddress.ToString ("MMMM dd, yyyy HH"))

    Seconds since January 1, 1970

    http://Qt-project.org/doc/Qt-4.8/QDateTime.html#toTime_t

    Sinds milliseconds January 1, 1970

    http://Qt-project.org/doc/Qt-4.8/QDateTime.html#toMSecsSinceEpoch

  • How to convert binary data NVARCHAR2?

    Hi all

    I have binary data in the database (RAW oracle data type). I know that these data contain string encoded in UTF8. Our database runs in WE8ISO8859P15 encoding, UTF8 national character set. Then I would just convert the binary data NVARCHAR2. How can I do?

    I found the UTL_RAW function. CAST_TO_NVARCHAR2. However, this function takes only binary data as a parameter, so I highly doubt that it will work as I hope without specification of source character set...

    Someone has an idea?

    UTL_I18N. RAW_TO_NCHAR ( , "AL32UTF8")

Maybe you are looking for

  • Update is not installed after a reboot

    The update tells me that I have to restart my computer to complete the update. After that I restarted the computer updating is not yet complete. What should I do? Thank you

  • Why my new 6s iPhone Bluetooth does not work?

    Hello! I recently bought an iPhone 6s and when I turn on the Bluetooth it is looking and looking and never find my other phone, it never finds any device. What can I do to fix this?

  • Pavilion g6 2320 tx: I can't send files on blue tooth

    my laptop model is pavilion g6 2320 tx. The factory installed OS has been version.later for 64-bit windows 8 I updated my os to 64-bit windows windows store 8.1 version. After the update I can't send all files on blue tooth on the other equipment, bu

  • Sansa Connect 4GB

    I recently bought the sansa connect 4GB. Well, it looks good, but I can't find the drivers on the Web site I tried the recovery of connection device, sansa updater installation and update the firmware but nothing works... before that I installed thes

  • Error code: 80070103 while installing optional updates for Brother printer

    I have an optional update from Windows for my Brother, update storage software released in Scanner printer May 2009. Published March 5, 2013. I tried this option of Windows Update and after a few minutes of installing the update for the Brother print