Date/Timestamp Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Date/Timestamp Question

Post by Pyrite »

I am developing a website/software that is going to be used for many years to come, and the site itself is planned to be used on Windows & Unix Servers. So right now I am using timestamps for dates (registration dates, birthdates, etc). I recently found out that Windows cannot make use of timestamps before 1970 or after 2038. So is there another way I can store my dates and still be able to format them. I am using timestamps so I can format them easily with the date function. If I store the date in MySQL in the format YYYY-MM-DD or whatever, is there a way to format it with php? Ideas?

Also, this is a multi-lingual site, and using timestamps allows me to set the right locale for each language so that the date function will format the date using that locale.
Last edited by Pyrite on Fri Mar 05, 2004 4:12 am, edited 1 time in total.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

try this library:
http://66.102.9.104/search?q=cache:pC9_ ... n&ie=UTF-8
not sure if it supports locale properly (if does it at all).
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you store dates in MySQL then you don't need PHP to format them you can do it with MySQL, do a search on DATE_FORMAT in the MySQL manual.

Unfortunately this doesn't answer the locale issue.

Mac
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Re: Date/Timestamp Question

Post by JayBird »

Pyrite wrote:I am developing a website that is going to be used for many years to come.....timestamps before 1970 or after 2038.
You think your site is going to be use until 2038? I don't even think the internet as we know it will exist then :)

Mark
Last edited by JayBird on Fri Mar 05, 2004 4:13 am, edited 1 time in total.
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

Well, my site isn't just for the Internet man (why the hell does everyone always question my logic?), also using my (lets just call it software instead of a website) software on CD's, DVD's and Flash Drives. My software will be used my hundreds of thousands of people for the next 100 years or more.

Ps. Wierdan to my Rescue (as Usual), that looks like exactly what I need. And I am already using ADOdb, so even better. Just have to test it. It should still work with the current locales, I'll let ya know if it does. Thanks Weirdan!!
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

errr...i was making a light-hearted comment

I'm intrigued as to what this is if they will be using it for the next 100 years.

Mark
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

I know, it's just that since day one, every thing I need help with that i've posted on these forums, everytime somebody just sits there and questions me on why I would do such a thing, or want to. My job involves a lot of thinking outside the box, and most people don't understand that. I'm not yelling, just perplexed. I appreciate your comments regardless.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

I think callenging someone logic is a good thing, someone may bring to light something you haven't thought about. Admittedly, i didn't do that.

Anyways.....

Mark
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

I know, I ought to write up a thread on what my project involves to refer people to when I ask these obsurd questions. Basically, it's a teaching/distance education site, that I also am not just using on the internet, but other mediums like I said. Kinda taking php/html and using them in a way that they weren't intended for.. but it is worth it for me.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

..for the next 100 years or more.
Sorry, but I have to question that.

Things change. Technology changes. Society changes. Mores change. Everything changes. Even religion changes to some degree.

The world is so different in just the sixty years that I have been alive that I can scarcely recognize it. Teaching instruments that are only 20 years old are so obsolete that we literally laugh at them now.

I recall that when I was in high school it was nothing more than an "interesting coincidence" that the western outline of Europe/Africa and the eastern outline of the Americas were so similar.

I cannot concieve that anything technological is going to be used "as is" for "100 years or more."
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Exactly what i was thinking

In fact, i was just reading this snippet from and article i read
Search Pets. Google representative Craig Silverstein offered his bizarre vision of the future of search during one Search Engine Strategies session. In a speech closely resembling a Star Trek episode, he shared his new prediction of search moving towards the existence of search pets hundreds of years from now. These search pets would not necessarily be like a pet dog, but more like "a genetically engineered beast."

Adding to the science fiction, he believes search pets will be able to understand emotions and allow people to search for things that aren't necessarily facts.

Helping increase and enhance communication, search pets will understand the way the world works and the way humans interact. Search pets will be able to determine and untangle what searchers mean politically and socially.

Google Brain Implants? If the search pets aren’t far out enough for you, Silverstein also shared his believe that search function brain implants may be in store in the distant future. Hundreds of years from now, the world of search as we know it will be completely redefined.

"We'll still search for facts," he says, "but in all likelyhood the facts will be contained in a brain implant."

Hmmm… so, how would you feel about having Google implanted into your brain?
I wonder what version of PHP we will be on when they introduce a brain_connect() function.

Mark
Last edited by JayBird on Fri Mar 05, 2004 9:53 am, edited 1 time in total.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

...Also, another few quotes
Chairman of IBM wrote:In 1943 the Chairman of IBM, Thomas Watson predicted...
I think there is a world wide market for maybe five computers.
Bill Gates wrote:Bill Gates was reported as saying... 640k should be enough for anyone.

This was the size of the memory in the earlier IBM Personal Computers.
Mark
cyberhawk
Forum Newbie
Posts: 11
Joined: Tue Mar 02, 2004 7:49 pm

Post by cyberhawk »

On the other hand.. 8) if the tech people of yesterday were abit more like pyrite, we would never have had the y2k <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>... sooo, help him out fellas.. as you've said, you never know what the future will look like. :wink:
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

See, I don't care about all the politics, and all this theory talk. I don't care, I care about php.

Ps. The Adodb Date Library works! Works with later dates in 1901 and on WindowsXP, up till Jan 19th, 2038, so I don't know why that isn't working, the page says dates up to or past the year 3000, but I dunno. I suspect that I'll just cross that bridge when I come to it, after all, in 2038 if Windows is still around, this stupid date bug will probably be fixed. The use of dates prior to 1970 was really critical for me for now.

Setlocale works with dates that were created with adodb_mktime() using the strftime function, but only for dates >= 1970. The ones before, the adodb_date function doesn't seem to consider setlocale, still playing with it though.
Post Reply