Long date format hex

Hey. Attempts to convert a hexadecimal string into a Long, and then to a Date. If I execute the following code
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
String filetime = "Wed Apr 13 19:20:19 2011";
DateFormat sdf = new SimpleDateFormat("EEE MMM dd hh:mm:ss yyyy");
Date dateFiletime = sdf.parse(filetime);
long longFiletime = WinBase.FILETIME.dateToFileTime(dateFiletime);
System.out.println(net.proteanit.util.StringUtils.toHexString(longFiletime));
I get on April 13 being the Hex String 01cbfa0fd37f9b80. If I then run this through my program, I get the result Fri Feb 02 18:06:40 GMT 4104773
import java.io.*;
import java.util.*;
import java.math.*;

public class test {
   public Date d;
   public String hexString;

   public test(){
       hexString = "01cbfa0fd37f9b80"; // Apr 13 2011 w/time

       long val = hexToLong(hexString);
       d = new Date(val);
   }

   public static final long hexToLong(String hex)
     throws NumberFormatException {
         int len = hex.length();
         if (len > 16)
             throw new NumberFormatException();

         long l = 0;
         for (int i = 0; i < len; i++) {
             l <<= 4;
             int c = Character.digit(hex.charAt(i), 16);
             if (c < 0)
                 throw new NumberFormatException();
             l |= c;
         }
         return l;
     }

   public static void main(String[] args){
      test sd = new test();
      System.out.println(sd.d);
   }
}
Anyone know why this might be the case?

see you soon

Because this hexadecimal string is not just the millis, since then?
See:

    public static void main(String[] args) {
        String filetime = "Wed Apr 13 19:20:19 2011";
        SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd hh:mm:ss yyyy");
        try {
            Date dateFiletime = sdf.parse(filetime);
            System.out.println(dateFiletime.toString());
            System.out.println(Long.toHexString(dateFiletime.getTime()));
            System.out.println(new Date(Long.parseLong("12f5017aab8", 16)).toString());
            System.out.println(new Date(Long.parseLong("01cbfa0fd37f9b80", 16)).toString());
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }

As a result:

Wed Apr 13 19:20:19 BST 2011
12f5017aab8
Wed Apr 13 19:20:19 BST 2011
Fri Feb 02 18:06:40 GMT 4104773

It's the original analysis.
The hexadecimal string from this date.
The result of the conversion than hexagonal back to a long and back to a Date (using Long.parseLong).
The result of the conversion of your hex for a long, and then for a Date (using Long.parseLong).

If your is over the 4104773 year.

Tags: Java

Similar Questions

  • Lookout 6.2 displays formatted data in hex/BCD (152) from AutomationDirect 250-1 as a decimal (338).

    How can I configure Lookout to display the number (152) formatted hex/BCD?


  • Problem with the conversion of getDate() to Date format?

    Hi guys,.

    I need to convert the date selected for DateField string format (for example: yyyy-mm-dd).

    I put the date format DateField as "mm-dd-yyyy '.»

    I tried to get the date of this DateField and tried to convert the format 'yyyy-mm-dd ".

    When I tried, I had a bad outing.

    For example, when I selected 12 months he returned as "00" the following coding.

    SimpleDateFormat dtFormat = new SimpleDateFormat("yyyy-mm-dd");
    Date dtToConvert = new Date(mydatefield.getDate());
    strRequired = dtFormat.formatLocal(dtToConvert); 
    

    Can someone explain what that is the bug with this code or any other way to get the output as my requirement?

    Thanks in advance,

    Stéphane

    Oops, sorry, code should have been...

    DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
    long dateLong = field.getDate();
    Date date = new Date(dateLong);
    String dateString =df.format(date);
    
  • Date format in the supporting - attachment Documents

    Hello

    Page of support documents - in 6.0 date format for entry into force and date unavailability has a descriptive format (Monday, February 17, 2014), but in the point 6.1 resembles the date format of the field has been in number as format (17/02/2014).

    Is there a way we can customize / format description to a numeric date format.

    Kind regards

    Kumar

    6.1 has brought a new editing tool and improved for the dates so that you can type the dates directly in the field or use the calendar control.  With this control, we are unable to show the descriptive long format in edit mode.  In playback mode the descriptive date must always shown as "Monday, February 17, 2014" Unfortunately it seems that the behavior of the old system that you cannot open the popup details of attachment in read mode so that you will never see these inactive/effective dates in a full descriptive format.

    Good news if

    1. we now offer a review of supporting documents report.   This report will let you see all the supporting documents on a single specification or through a hierarchy of specification.   You should be able to set the date format to display in the long descriptive view.  In the BI publisher layout tool, click the column and change the formatting in the form under "Formatting data" in the toolbar.   Discover our pack of extensibility for more information on this report and others.

    2. We hope to offer in our next major release of universal date as February 14, 2014 formats and you will be able to see the document in support and the details of the attachment in read mode.

  • Set the default Date Format in 4.2 jQuery Mobile Smartphone

    Hi guys,.

    on 'normal' office interfaces, you can set a default date format in the globalization settings. Currently I am working on an application JQM and I noticed that the same settings I have to format date in other applications, take effect.

    I read today in the 4.2 notes version, that somehow this question was a bit buggy. If this problem is corrected? I would firstly like JJ German date format. "" MR. YYYY "; (such that it works in office applications). How can I do? This entry is saved in the global settings.

    But whenever I want to put a date-picker-merchandise in this format, it changes again in 'YYYY-MM-DD' after registration. And I don't really want to enter a dml processing conversion function writing now.

    Thanks for all tips, best looks,.
    Tobi

    Hey Tobi,

    the item type of ' date picker (HTML5) "corresponds to the type of input HTML5 = 'date', which requires that the internal format of the value date must always be YYYY-MM-DD, but he returned to the browser to display the date in the format of the local operating system parameter. The browser of the iOS for example displays the date in the format of my setting local language/country.
    See also http://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format

    To make a long story short, it is not possible to specify the display format for dates selectors, because this is not supported by the HTML5 specification.

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • View the long data type

    Hello

    I use coldfusion 7 and oracle 10g.

    I'm trying to display a field (aprconf_comment) who have a LONG data type and that is formatted with carriage return.
    The problem I have, is the maintenance of wagons return entered by the user.
    The text that is displayed is all in a single paragraph, that all the wagons back had been withdrawn.

    Does anyone know how to keep the return transport?

    Thank you
    Chantal

    Here is my select code
    < name cfquery "allWealth' datasource = #TheDataSrc # dbtype = #TheDataType = # >
    Select *.
    of avwh_bio_wealth
    where aprconf_pidm = ' #ThePidm #
    and aprsubj_subj_code = 'WHLT.
    < / cfquery >

    Here is my code to display
    < cfoutput query = "allWealth" >
    < b >
    < td align = "Left" > < class p = "text" > #aprconf_comment # < /p > < table >
    < /tr >
    < / cfoutput >

    For future references.

    In fact, looking for others, I found this function
    ParagraphFormat() worked a little better for me
    because the text remained inside the window, not as

     
    .

    I guess that ParagraphFormat() creates "soft returns.

    Thank you all,.
    Chantal

  • How to advocate for regional change of short date format

    This is something relatively trivial but annoying all the same, but I don't know where to go to advocate for change.

    Have just updated for Sierra and one of the first things I notice is the addition of a point at the end of the month in short date format, i.e. 'September 19, 2016'.

    "In Australia, as in the United Kingdom, the standard must not use this period - it should be just'19 Sep 2016", and in the past, that's how it appeared in OSX for the Australia. Don't know why the change.

    This abbreviation is not replaceable by the user, so where can I go to provide appropriate feedback and I hope to have this problem on the track?

    A solution is to make my default language and region of the United Kingdom, but do not know if there is a price to pay for it.

    You can provide feedback to Apple asking them to change it:

    www.Apple.com/Feedback

  • How do I change the date format in the section of the United States to the United Kingdom

    As in the question.

    Hello

    I had a glance in this and have found that Thunderbird uses the date format of your computer system. If you change it, it should be reflected in Thunderbird.

    I hope this helps, but if not, please come back here and we can look at another solution for you.

  • How can I configure the cell data format

    How can I configure data format of cell numbers: for example, I want to capture 123456.78 and need to be 12A3456.78?

    I tried to put #A # #. # format option, but it didn't work a few time and it became A123456.78.

    I also tried on excel and it worked very well, but I like the numbers better. is there a solution to this problem?

    Thank you

    HEY Chi - Lun,

    I don't think that this is possible as many number format. You should be able to insert A in a text string using a formula, but this would happen in a second cell, not that the number has been entered.

    "Assuming all the"numbers require the same inserted letter after the second number, this should do the work."number" entered in column A; the formula in column B. In the table below, your value as an example is A6.

    = Left (A, 2) & "A" & RIGHT (A, LEN (A) - 2)

    Kind regards

    Barry

  • Date format of messages is absolutely ugly

    Hi all.

    I'm really frustrated format of date/time of Messages on my iPhone6 (and also on my OS - X).

    What the main reason for the use of the words 'Today', 'Yesterday', 'Saturday' and other?

    Who need this lyrical sh * t? All my friends is also frustrated by this function, because if you need a specific date for the quote or shipping screen, you will need to do a lot of unnecessary travel.

    I mean - if you want to find something and need to translate "what the date was Saturday?", you need to go to calendar and look here, what date was Saturday.

    Apple !

    Please, I beg you! Make this switchable feature!

    This date format looks like completely unnecessary and useless decoration.

    Simply return the precise date.

    p.s. this message angry wrote after a misunderstanding with screenshots attached in the e-mail Messages.


    iOS version: 9.3.3

    The OS - X version: 10.11.6

    Not something anyone here can do for you. You can offer your comments Apple here.

  • How canI change the date format of dd/mm/yyyy to dd/mm/yyyy in filed?

    I just got and try things my new Alcatel fire E with FirefoxOS (just updated) 2.0.0.0.

    It is usual in most operating systems to be able to customize the date and time (among others). After a few hours of unsuccessful fiddling with the phone and checking the various forums, I came to the conclusion that it is currently not possible on my phone with this version of FirefoxOS. Or did I just miss something?

    Achim

    Hi achim_59,

    I understand that you want to set the date format to display the jj/mm/aaaa on your Firefox OS device.

    This feature has been implemented in Firefox OS v2.1. Unfortunately, this feature is not available in v2.0:

    For other questions about the updates and implementation of your specific device features, please contact your device manufacturer, Alcatel.

    -Ralph

  • How can I change the date format in Thunderbird for the list of received messages?

    Through 19/02/2015 12:28, I received my email with this format. Since that time, all the date Watch column is the time, the date does not show. How to get back to the default time and date format?

    The default is to show all the time on messages from today, with the date and time on all the other messages.

    http://KB.mozillazine.org/Date_display_format

  • Possible to get the European date format by default without UK correction?

    I have some terrible evil with the terrible in Excel and other programs American date format when I have my computer, the value of the American region.

    I thought I fixed that by changing just my computer region UK but now I have GBP currency by default and autocorrects obnoxious affecting my Z s and add unnecessary U in every way.

    I live in a non-English speaking part of Europe, but my native language is English and I work mainly with the dollar sign ($).  Is there anyway to get the normal spelling, the right currency by default ($), 24 hours, but without the fool US default date format?

    Thank you.

    Explore SystemPreferences settings: language and region and the Advanced button.

  • I created a custom and registered with a specific name date format. However, when I open a new worksheet, my saved format does not display in the menu drop-down? Am hoping that I don't need to create the same format for each new sheet?

    I created a custom and registered with a specific name date format. However, when I open a new worksheet, my saved format does not appear in the menu drop-down? Am hoping that I don't need to create the same format for each new sheet?

    You must save the spreadsheet containing the new date as a model format and use this custom template for each new spreadsheet where you want that this date format personalized at your disposal.

  • Is there a way to use data formats i.e. Go Mo Ko in numbers?

    Is there a way to use data formats i.e. Go Mo Ko in numbers?

    I am trying to add the size of the library files to estimate the needs of the HD. If I had the files on my system I could just put them in a folder and the operating system would be to calculate them for me, but I don't have them yet. I have a list of files and their size in GB.

    Someone has it worked?

    I suggest the following:

    Create a second table called "convert".

    In this table, enter the first column as show (pasted here so you can copy)

    Value

    Divide by

    suffix

    0

    1

    b

    400

    1024

    Ko

    1000000

    1048576

    MB

    1000000000

    1073741824

    GB

    1000000000000

    1099511627776

    TB

    Appropriate now in the table 1 use the conversion table to change the size of the files in the format:

    "C2 = ROUND (B2÷VLOOKUP (B2, Convert::A:C, 2, 1), 2) &" "& VLOOKUP(B2,Convert::A:C,3,1)".

    It's shorthand dethrone select cell C2, then type (or copy and paste it here) the formula:

    "= ROUND (B2÷VLOOKUP (B2, Convert::A:C, 2, 1), 2) &" "& VLOOKUP(B2,Convert::A:C,3,1)".

    Select cell C2, copy

    Select cells C2 at the end of the C column, paste

Maybe you are looking for