|
Joined: Jan 2001
Posts: 32
User
|
User
Joined: Jan 2001
Posts: 32 |
I'm just trying to figure out how W3T stores its dates in the database. What I am really wanting is to be able to post backdated messages - I don't mind altering the database itself but trying to figure out what the new 9 digit date stamp string should be is exercising my tiny brain a little.
Also I'd like to hack w3tnews.php so that it can display a date format of 'Dayword, nth Monthword fourdigityear' but simply using gmdate() will not work as it needs a php timestamp format, so having an algorithm to convert the stored value to that would be useful.
TIA
Jock
|
|
|
|
Joined: Aug 2000
Posts: 262
Enthusiast
|
Enthusiast
Joined: Aug 2000
Posts: 262 |
i think it is in seconds, seconds from 1982 or something when php was invented. [:red]-------------- http://extremeforums.org/index
|
|
|
|
Joined: Jan 2001
Posts: 32
User
|
User
Joined: Jan 2001
Posts: 32 |
I got the impression that the date/time string I was referring to was specific to w3t and not php. I am only just getting to grips with php, but looking through the various date and time functions I don't get the impression that they match the w3t format.
I think I had worked out that it's in seconds, but can't work out quite how to calculate it back to its origin in order to come up with a workable algorithm for manipulating it.
If I could even find where in w3t it is first stored I could maybe work it out. If it is as simple as using a standard php function on it that would be great, but I can't work out which one...:-)
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
The dates or stored in seconds since the epoch. The dates are retrieved via the php time() function, and converted back by using the date function like this:
$realdate = date("/m/d/y h:i A", $time);
Where $time is the date that is being converted, in seconds.
UBB.threads Developer
|
|
|
|
Joined: Jan 2001
Posts: 32
User
|
User
Joined: Jan 2001
Posts: 32 |
Thanks both - I will try it out.
Jock
|
|
|
|
Joined: Jan 2001
Posts: 32
User
|
User
Joined: Jan 2001
Posts: 32 |
Actually thinking about it, that only answers one side of the equation, and perhaps I shouldn't expect people to do all my work for me..:-), but what I am looking for is a method of taking an 'English' date/time and converting it to the php date/time stamp string. I think, though I haven't looked through <i>every</i> single piece of code so may have missed one, that the w3t system only ever converts a system date/time to a php time and a stored php date/time string back to a human readable date/time.
To hack a 'backdated' posting I need to be able to take a human readable date/time and convert it to a php date/time string for storage. Any ideas? I needn't be fussy about formats at the moment as it would only be an administrator that can put in the backdated stuff - it's basically to do with inputting historical data so that it appears in the right order - press releases that need to display the applicable release date and be sorted in the database according to that date.
Jock
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
Guru
Joined: May 1999
Posts: 3,039 |
You are correct, I only convert from a datestamp to a date. To go the other direction you will want to check out this php function. It will take just about any date format and return a unix timestamp.
UBB.threads Developer
|
|
|
|
Joined: Jan 2001
Posts: 32
User
|
User
Joined: Jan 2001
Posts: 32 |
Excellent - thanks Scream. It's not in the PHP book I'm relying on, and though I do try to check php.net I had not sussed that one out. Looks promising.
Jock
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 87
Joined: December 2001
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|