Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

date and time formats?

Posted on 1998-12-11
4
Medium Priority
?
233 Views
Last Modified: 2008-03-06
hi,
I'm searching for date and time formats (international/computer/ANSI ....).
Anyone with a doc or web site?
 
0
Comment
Question by:nil_dib
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1179928
Not that I can help, but to clarify for other experts, do you mean storage formats (data formats) or do you mean "expression" formats.  i.e what people use to express times and dates?
0
 
LVL 4

Author Comment

by:nil_dib
ID: 1179929
Is there a difference between storage formats and "expression" formats?
The formats should be be used within my application ( e.g. timestamp ) but
should also displayed for the user ....
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 200 total points
ID: 1179930
It is up to you internally, there appear to be 3 common varieties of common ways to do this.

Internal formats :-

(a) seconds since start point (e.g. 1 Jan 1970).  With a 32bit integer number you get a range up to about 2038.  Examples <time.h> in C Standard library and CTime in MFC
(b) floating point since start point.  1 = 1 day.  Part days are stored as fractions.  Example COleTime in MFC.  COleTime has a range of about 100AD to 9999AD
(c) Store year, month, day as integers (use 4 digits for year !)

MFC and C libraries have routines to convert from (a) to (c).  MFC has a routine to convert from (b) to (c) too.

COleDateTime in MFC has a display mechanism (Format) and parsing mechanism (ParseDateTime)

In terms of display, I suggest you follow the user's locale settings.  The cultural norms in different countries vary widely, e.g.

D/M/Y - UK
M/D/Y - US
Y/M/D - I think Japan and Sweden
(and this isn't even getting to times)

There is an ISO standard for dates (8601), and a nice explanation at
http://www.cl.cam.ac.uk/~mgk25/iso-time.html

This basically suggests using Y/M/D.  Personally I don't think everybody should be forced to confirm with this (it's not a convienent to type in or read dates like this if you don't regularly use em)


0
 
LVL 22

Expert Comment

by:nietod
ID: 1179931
Huge difference.  A serial date is stored as a binary integer,where each day after a certain starting date is represented by a consevtive number.  i.e. 01/01/1900 might be 0 then 01/021900 might be 1 etc.  In a BCD you might store the date using 8 bytes that store the ASCII value of the date digits in year month day order, so 12/11/1998 would be stored as "19981211".  In packed BCD the values would be stored using HEX digits like 0x19,0x98,0x12,0x11.  There are dozens of other possibilities.  These have nothing to do with how the numbers are expressed to the user.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

604 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