Jump to content

Date inconsistency problems


nats

Recommended Posts

I am trying to upload files into MySQL database using PHP...& I've already done that..but I also want the current date & time of uploading to be stored in the database(the files can be uploaded from any terminal in an intranet).

 

Now the problem here is that, the current date comes form the system's date & is the stored into the database...but different systems have different dates and none of them are consistent...

 

Hence I wanted to know if there is a way out to avoid this whole mess...

Link to comment
Share on other sites

but different systems have different dates and none of them are consistent..

 

??-- hmmm -- ??

 

I am stumped on this one. Is this a global application? Why do the different systems have different dates... and do you mean servers or the clients?

 

It seems though, that your going to have to create a time offset for each user... i.e. let them choose their timezone. Then store that with the server's time and when it is displayed, use the offset to modify the timeshift.

 

Nate

Link to comment
Share on other sites

like nate suggests, there must be a user database where each user's information is stored.. E.G. Name, UserName, PassWord.. make everybody re-register.. but make a new field.. TimeZone field.. which would be like

 

-5 -4 -3 -2 -1 0 1 2 3 4 5

 

than get your server's timezone, and calculate the difference..

 

either that.. or make your server's time the STANDARD time.. and let everybody know your server is for example.. -3GMT then when sum1 uploads it.. they'll know if they're -5GMT (like me) that if its 2:00 in the database for that file.. it was really uploaded @ 12:00..

 

furthermore.. instead of changing and shifting time, for each individual.. having 1 SET time, to gauge all the time measuring is more effective for a business/database anyway

Link to comment
Share on other sites

This a an e-learning portal which is currently on an intranet level(i.e within the college campus)...wherein multiple users can login through different terminals...& the stuff which they upload is being stored into the server's database...(into a field called as Date_of_submission having type as DateTime)

 

How do I enter the server's current date into the database while some user is trying to upload a file?

 

Link to comment
Share on other sites

Now the problem here is that, the current date comes form the system's date & is the stored into the database...but different systems have different dates and none of them are consistent...

 

Hence I wanted to know if there is a way out to avoid this whole mess...

Use one consistent data, that of the database.

 

And get in the habit of ensuring that the correct date/time is maintained on your servers

Link to comment
Share on other sites

okay, nats

 

Your server is a campus server..

 

this means that only computers on the SAME campus can access this via intranet.. now, unless your school is somehow EXACTLY where two time zones meet, than its pretty safe to say..

 

the server time will always be the server time.. wh ether uploaded from the guy in 1A or the girl in 2C.

 

That being said..

 

whenever a file is uploaded..

 

set the `time` field to

 

time() that will give a timestamp.. or you can do

 

date("F jS, Y h:iA");

 

that will return something like

 

June 3rd, 2008 12:32AM

 

 

Link to comment
Share on other sites

thanx Russell

Well i had the same thing in my mind...but now i hav 1 more doubt..

is there ne way we can handle wrong dates set in the server machine..

coz my project has features where we have to store the date of post, date of submission etc..

if the server is set to a wrong date then the server time which will be stored in the database, will be wrong.

So is there ne way to handle this problem (other than manually setting the correct date in the server) ?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.