473,382 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

time sub standards

Hi

1088553069 => Wed Jun 30 01:51:22 2004 CEST

I can do the time INT string substitution,
but I want a set of "country codes", in order
for my users to be able to pick their own
preferences. This set should include American
and European date format (`month/day' vs. `day.month'),
American and European time (AM/PM vs. 24hours).
Are there more features in major communities?

Question: Is there a predefined/official set of
time subs?

Thanks
Daniel
Nov 14 '05 #1
2 1765
Daniel Jung <ju**@uib.no> wrote:
1088553069 => Wed Jun 30 01:51:22 2004 CEST

I can do the time INT string substitution,
There is no such thing as a time INT. There's time_t, but it's not
guaranteed to be an int by any means, let alone an INT.
but I want a set of "country codes", in order
for my users to be able to pick their own
preferences. This set should include American
and European date format (`month/day' vs. `day.month'),
American and European time (AM/PM vs. 24hours).
Are there more features in major communities?
Year in front of or after month and day, two- versus four-digit year,
zeroes, spaces, or nothing in front of 2:30 and 3/4/1995, and then, of
course, there is the whole "Sun/Son/Zon/Dom/Dim/Boc" diversity, and
similar for month names.
Question: Is there a predefined/official set of time subs?


ISO should have one (a web search reveals that you should be looking at
ISO 8601), but no C implementation is required to support any of them.
However, should you have a way to find out which time zone your user
requires and which time zone your computer is in (ask the user?), you
can print the required information using strftime().
The information you get from gmtime() and localtime() _should_ be
reliable, that is, should return GMT and local time respectively, if
your computer is set to the right time zone, and in anything modern will
be; however, on MS-DOS, for example, there was no standard way of
indicating what your time zone was, and the compiler had to make
assumptions.

Richard
Nov 14 '05 #2
On Wed, 30 Jun 2004 07:23:29 GMT, rl*@hoekstra-uitgeverij.nl (Richard
Bos) wrote:
Daniel Jung <ju**@uib.no> wrote:
but I want a set of "country codes", in order
for my users to be able to pick their own
preferences. This set should include American
and European date format (`month/day' vs. `day.month'),
American and European time (AM/PM vs. 24hours).
Are there more features in major communities?


Year in front of or after month and day, two- versus four-digit year,
zeroes, spaces, or nothing in front of 2:30 and 3/4/1995, and then, of
course, there is the whole "Sun/Son/Zon/Dom/Dim/Boc" diversity, and
similar for month names.
Question: Is there a predefined/official set of time subs?


ISO should have one (a web search reveals that you should be looking at
ISO 8601), but no C implementation is required to support any of them.


8601 defines only *formats*, no "subs" (algorithms).

The C standard provides conversions from time_t to and from
"broken-down" struct tm in whatever the implementation considers the
local timezone, and only to (not from) broken-down UTC (called, very
slightly inaccurately, GMT), and (several, closely related) output
formatting routines that do little to handle such variations.

POSIX adds "locales" which (attempt to) allow for "cultural" (language
and convention) variation in several areas, including date/time
formats, currency/money and number formats, and alphabet ordering
(sorting) and casing; strftime() is extended to include the date/time
format items; and strptime() is added for "unformatting" input.

While POSIX does allow the locale to be explicitly set and changed by
a program, by default it is set from environment variables which can
and should be set once and used by all programs. Unless you have a
reason to do otherwise you might consider using that method.
However, should you have a way to find out which time zone your user
requires and which time zone your computer is in (ask the user?), you
can print the required information using strftime().
The information you get from gmtime() and localtime() _should_ be
reliable, that is, should return GMT and local time respectively, if
your computer is set to the right time zone, and in anything modern will
be; however, on MS-DOS, for example, there was no standard way of
indicating what your time zone was, and the compiler had to make
assumptions.

Note that time-zone -- that is, rules for how clocks are offset from
UTC/GMT, and in particular if and when "daylight savings" or "summer"
time is used -- is separate from and in addition to cultural
variation; you can have multiple timezones in one culture or country
(viz US, RU, CN) and multiple cultures in the same timezone (viz EU).
Both can be important for a good user/human interface.

- David.Thompson1 at worldnet.att.net
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

162
by: Isaac Grover | last post by:
Hi everyone, Just out of curiosity I recently pointed one of my hand-typed pages at the W3 Validator, and my hand-typed code was just ripped to shreds. Then I pointed some major sites...
34
by: Justin Timberlake | last post by:
I was thinking about all those /Indian Outsourcing/ companies getting those .Net shops set up. 0. Nobody uses .NET in the real world, it's all java. 1. MSFT is about to collapse as witnessed by...
4
by: dotNetDave | last post by:
About three weeks ago I released the first .NET coding standards book titled "VSDN Tips & Tricks .NET Coding Standards". Here is what the famous author/ speaker Deborah Kurata says about it: ...
96
by: John Harrison | last post by:
I knew that unsigned integral data types were the cause of scads of mostly spurious warning messages, but I didn't realise that they were a security risk too (see here...
23
by: Mario T. Lanza | last post by:
I have been authoring web sites for several years now and recently come to value web standards (as touted by Zeldman and many other web gurus). I have noticed with frustration that there are so...
27
by: Mike MacSween | last post by:
Some of my users are getting 'Disk or Network Errors'. I've raised it with the network admins, they're looking into it. In the meantime... My 'standard' error handlers logs errors to a table...
115
by: junky_fellow | last post by:
What is a C object ? If i have some function "func()" in my C program, then can i say that "func()" is a C object ? or if i have some function pointer (ptr) which contains the address of...
9
by: Jason Gogela | last post by:
Does anyone out there know why I should care whether a <span> is nested in a <p> or vice versa? What is the bennafit of adhering to this standard? It seems to me that regardless of which way you...
18
by: Sven | last post by:
Hi, I found a strange behaviour when using the time() function from time.h. Sometimes when it is called, it does not show the correct time in seconds, but an initial value. This time seem to be...
3
by: editormt | last post by:
A recent poll asked if programming standards are used by development organisations... and if they are controlled. None: 20% Yes, but without control: 49% Yes, with control: 31% Participants:...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.