Previous Thread
Next Thread
Print Thread
Rate Thread
#208027 02/02/2001 12:36 PM
Joined: Jan 2001
Posts: 32
User
User
Offline
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


Sponsored Links
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
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

vent #208029 02/02/2001 2:32 PM
Joined: Jan 2001
Posts: 32
User
User
Offline
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
Offline
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
Sally #208031 02/02/2001 4:15 PM
Joined: Jan 2001
Posts: 32
User
User
Offline
Joined: Jan 2001
Posts: 32
Thanks both - I will try it out.

Jock


Sponsored Links
Sally #208032 02/02/2001 7:13 PM
Joined: Jan 2001
Posts: 32
User
User
Offline
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
Offline
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
Sally #208034 02/02/2001 10:01 PM
Joined: Jan 2001
Posts: 32
User
User
Offline
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



Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)