Some notes regarding timestamps.
Defining a Timestamp
A timestamp is stored as a 26 character field. But, the system looks at it as a special data type and enforces the rules it has set up for timestamps.
The format for a timestamp is is YYYY-MM-DD-HH.MM.SS.XXXXXX (Year-Month-Day-Hour.Minute.Second.Milliseconds).
An example would be ‘2011-09-14-22.06.48.592000’ (Year: 2011 / Month: 09 / Day: 14 / Hour: 22 / Minute: 06 / Second: 48 / Millisecond: 592000) .
The default value for a “*blank” time stamp is ‘0001-01-01-00.00.00.000000’.
In DDS a timestamp is defined with just the field name and a ‘Z’ in the data type column.
In RPG a timestamp is defined in the ‘D’ specs as the field name plus a ‘Z’ in the Internal Data Type column.
In SQL a timestamp is defined as ‘field-name TIMESTAMP NOT NULL WITH DEFAULT’.
Working with Time Stamps
As stated, the system will choke on an incorrect timestamp when it encounters one. So, a timestamp must always be handled as a timestamp and not a character field (no *blank, no *zeros, no character values other than those listed above).
DDS will automatically load ‘0001-01-01-00.00.00.000000’ into a timestamp when a record is written and the timestamp is *blank.
To initialize and load the current timestamp value in an RPG program: TimeStamp = %timestamp()
or you can use the TIME opcode in older RPG programs.
The preceding operations will load the timestamp value, but the last 3 digits of the millisecond segment will be ‘000. To get the complete millisecond value use: exec SQL set :TimeStamp = current_timestamp;
Of course, this means the program has to be SQLRPG or SQLRPGLE. If that’s an issue, you can always create a utility program or service program that executes that SQL, and call it from other programs to get the timestamp. That way you don’t have to change the program type on countless programs. Personally, I create most of my programs as SQLRPGLE to begin with, so it’s not an issue for me.
To extract the date (as date data type) from a timestamp use: Date = %date(TimeStamp)
Remember, although the timestamp “looks” like a character field, it is really not. So, to get it into a character field, you can either to a MOVE operation or these built-in functions: Char = %char(TimeStamp). (Move operations work with any data type).
Related articles
How to view timestamps for individual texts and iMessages in iOS 7(imore.com)
Android Java – Tips (Convert time stamp to preferred date format)(ronscript.wordpress.com)

What Should Be This Characters Field Of Expertise Be? The story takes place in a fictional world, but the technology is very modern like (with social structure being a mix of Victorian and Modern era).
Anyways, the story follows an immortal bounty hunter (he’s a king from a long forgotten nation).
Anyways, the character is generally quite absent minded. He’s a major blood knight, and is easily distracted from the main goal. He has a terrible sense of direction, and his partner has made numerous jokes about him; getting Alzheimer’s in his old age, or him getting shot in the head too many times. He’s also quite vain, for example; he wears an eye patch that he doesn’t need (he had to wear it when he lost an eye during a fight, but he has since grown a new one) because he thinks it makes him look more “badass”.
Anyways, I thought it would be funny if I shocked readers by revealing that he was some sort of doctor or professor (his full name is Felix Larkin, what sounds better Doctor Larkin, or Professor Larkin?) in one of his past identities.
View CommentLast two answers are douche-bags. You do realize, I meant academic doctor, right?
Felix Larkin, MD
View CommentHe used to be a proctologist . He stopped practicing because of his bad sense of direction.
What Is The Lowest Negative Number That Can Be Stored In A Double Data Type In Java? Double.MAX_VALUE and Double.MIN_VALUE returns positive max and min value. but how can i find the lowest negative value that can be stored in a Double data type.
Thanks a lot in advance. 🙂
View CommentI think you are asking for the negative value with the largest magnitude? Well, java double primitive data type (not to be confused with Double object type) is a *signed* 64-bit floating point value. The first bit is a sign bit. Therefore, the largest negative value (in absolute magnitude) is:
-Double.MAX_VALUE
Yes, that’s right. You just put a negative sign in front of it. 🙂
View CommentOutline The Benefits Of Having A Variety Of Data Types Available To The Programmer? Can someone please outline the benefits of having a variety of data types available to the programmer in very basic detail……need answers ASAP!
Thanks!
View Comment???
a programming question in psychology?
what kind of data? actuarial? statistical? demographic?
View CommentSQLServer Timestamp Format? I’m accessing some legacy data stored in SQL Server, and my framework is convoluting the timestamp, so that I can’t read or write to the field of type timestamp. Does anyone know the format SQLServer is looking for with a timestamp? (When I look at it in my third party tools, it just shows that it’s binary data.)
Thanks in advance.
View CommentIt’s dreaded timestamp in SQL server. Though the name says it is timestamp, it’s really not. So don’t do a read/write on that column. It’s a kind of rowid precisely. By definition from SQL server books:
”
The SQL Server timestamp data type has nothing to do with times or dates. SQL Server timestamps are binary numbers that indicate the relative sequence in which data modifications took place in a database. The timestamp data type was originally implemented to support the SQL Server recovery algorithms.
It further states Never use timestamp columns in keys, especially primary keys, because the timestamp value changes every time the row is modified.
View Comment”
Hope it helps.
Do You Think A Footballers Character Is Reflected On The Field? Or do you see them as two separate things?
View CommentI think the word “footballer” describes their character. their immage is determined by the press
View CommentWhy Do We Need Structured Data Types?
View CommentDo you mean Abstract Data Types or Data Structures? I shall endeavor to provide answers to both questions.
Data structures:
A data stucture is a way of structuring data so that your chosen algorithm can process the data in an efficient manner, i.e., in such a way as to utilize as little storage space and execution time as possible. There are myriad ways to structure data, however, the most common method by far is the ubiquitous array. Data structures ranging from the simple to the complex are based on the node. A node is simply a collection of two sections of memory. One section of memory stores the data. The second section stores a location to another node in memory. If there isn’t another node then the node stores a NULL (nothing essentially).
Abstract Data Types:
Computers do not natively know how to deal with numbers. *GASP* “Blasphemy,” you say! “Computers don’t know nothing BUT numbers!” nuh uh uh… computers don’t know anything. All a computer does is deal with on and off switches, essentially. Therefore, the programmer and CPU designer must tell the computer how to deal with numbers. Integers, the set of all real numbers — i.e., -3,-2,-1,0,1,2,3, are infinite. A computer is finite. I can’t go into how a computer deals with integers exactly. I could get into the binary representation but I have a feeling that you wouldn’t know what I was talking about.
Programmers need data types that the compiler does not offer. The compiler offers integers, floating point, characters, strings, etc. But what if the programmer wanted a data type that dealt with coordinates? He/She would simply define a class or a struct that contained data and methods to act upon and maintain that data.
{
int X = 0;
int Y = 0;
} Point;
int main()
{
coord = Point;
coord.X = 200;
coord.Y = 100;
return 0;
}
[PHP] How Do I Get A Week Value? I have to create an array of strings which need to be formatted like this:
(Week number): Sat (date)
I need to include every Saturday for the year in my list.
I know that date(“W”) returns the ISO8601 week number.
I also know that date(“D MjS, Y) will return the year like this: Mon Sep 12th, 2011.
How do I go about finding each Saturday of a given year and also each Saturday’s ISO week number for my string?
Additionally, it needs to limit this to the current year.
View CommentIt’s fairly straight forward, if you use timestamps. As with anything with PHP, there are multiple ways of doing this. I like the simplicity of using timestamps, so I have included an example with notes here:
http://pastebin.com/EcFB59Ki
Cheers,
Gitlez
Feel free to contact me through my profile page if you have any follow up questions.
View CommentGet How Many Minutes Ago A Timestamp Was In Php? I have a TimeStamp 2011-02-04 05:05:50
View CommentHow could i find out how many minutes ago it was? Like say a timestamp was 5 mins ago, it would just echo 5.
Since timestamps are expressed in seconds, calculate the difference and then divide it by 60. Something like this should work:
< ?php function time_diff($timestamp) { return floor(abs(time() - strtotime($timestamp)) / 60); } $event_date = "2011-02-05 01:45:50"; echo time_diff($event_date); ?>
I used floor so that if the difference is, for instance, 59 seconds, the function will return 0 (it is not a whole minute). If you want to round up the minute value, replace floor() with ceil().
View CommentWhat Are The Different Data Types Supported By C++?
View CommentLearn the significance of each data type. A void type means “no data” or represents a generic pointer. The int type stores positive or negative whole numbers and is 16 or 32 bits long. “Float” (32 bits) represents decimal numbers with a moveable (floating) decimal point, and double is an extra precise float that’s 64 bits long. “Char” (8 bits) represents printable characters, and wchar_t can store a wide character literal. “Bool” (8 bits) denotes true or false.
Step2Use the following syntax to declare a data type in your program as the following example shows: data type keyword, space, variable name, comma, space, other variable names, semicolon. Precede the data type keyword by a data type modifer, if necessary. See Step 3 for explanations on type modifiers.
int num1, num2, num3;
Step3Learn the type modifiers: signed, unsigned, short and long. If you put one by itself, the compiler assumes you mean int. The short modifier makes an int 2 bytes while long makes it 4 bytes.
Step4Initialize a variable by putting an equals sign after it and giving it a value. You can do this during the declaration or after it.
int x = 14, y; // during declaration
y = 34; // after declaration
Step5Form an arithmetic expression using data types as follows:
unsigned int seconds = 60, minutes = 60, hours = 24, total;
total = hours * minutes * seconds;
Step6Create a more complex data type by using char. An array is a data structure that can hold a row of elements of the same data type. An array of char functions as a string.
char word[6] = {‘H’, ‘e’, ‘l’, ‘l’, ‘o’, ‘