Date Conversion

Posted on 2011-05-09
Last Modified: 2012-05-11
I have dates, e.g. ,12/13/1985, which I must convert into a 5 digit number.  Is there a format for which this can be done. A Julian date gives me 7 digits plus the fractional hours and minutes. However, I need five digits. Please don't ask why.
Question by:gbm33
    LVL 3

    Expert Comment

    You could write it in hex decimal

    year = 3
    2010 = 7da  

    month = 1
    12 = c

    day =1 or 2
    1 = 1
    31 = 1f

    2010 12 1 = 7dac1
    2010 12 31 = 7dac1f

    Author Comment

    babesia: Thank you for the suggestion. However, I must have digits, i.e., numerical only, not alpha--numeric.
    LVL 9

    Accepted Solution

    format DDDYY where DDD is Julian day (1 to 365) and YY id last 2 digits of year.
    If YY < 20 then year = 20YY else year = 19YY
    January 27 2011 = 02711;
    January 27 2010 = 02710;
    January 27 1978 = 02778;  
    November 27 2010 = 33110

    Author Comment

    Orcbighter: Indeed, your way is a way to concoct 5 digits from a date.  However, this is not the solution I will need. I think I need something that is a standard way like creating 7 digits with a Julian conversion.
    LVL 9

    Expert Comment

    Hi gbm33,
    The solution I gave you is a standard way for deriving a 5-digit date, with the proviso you have to have agreed on your start point in order to determine the century. I am not aware of any other.
    The old standard was ddmmyy, giving six digits and sparking the whole Y2K problem. The new standard is ddmmyyyy, giving seven digits (good until the year 9999 AD).
    If you want 5 digits, this is it, I think
    LVL 41

    Assisted Solution

    you can get the numbers of days from 1-1-1900 to 12/13/1985, that will give you 31394

    LVL 41

    Expert Comment

    Well, I have to object this. I did provided you with exactly what you asked for: a way to represent a date in a 5 digit format, which by the way is just like Excel would do it. So I don't understand why this disposition.

    Author Closing Comment

    These answers did not give me the information I needed but they both indeed do give a five digit number.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
    The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
    Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now