The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
When displaying a date to a user, I know vbdate() will offset according to a user's timezone, however what would I use when I want to offset a unix timestamp according to the user's timezone within the execution of a script?
|
#2
|
||||
|
||||
![]()
Do you know the user's timezone in your custom script? If so - you could just add the seconds on to the timestamp before formatting it. (e.g. user with +2.5 hours = TIMESTAMP + (2.5*60))
|
#3
|
||||
|
||||
![]()
I suppose I could gather the user's timezone difference like this:
$tzdiff = $vbulletin->userinfo['timezoneoffset'] then either increase or decrease the unixtimestamp appropriately, however I would have figured that vbulletin has a function already set up to handle something like this. I looked all through the API and couldn't find one that handled unixtime, only display time. This is somewhat surprising considering the fact that `dateline` is is used so often in post, thread, user tables etc... |
#4
|
||||
|
||||
![]()
When dates are displayed, they are run through vbdate(), meaning all offsets are already handled. The "stored" Unix timestamp is always UTC.
|
#5
|
||||
|
||||
![]()
correct - vbdate() handles display time, however I was expecting a function to handle just the unixtime. The code you provided above is simple enough, I will just use that and it should suffice - thanks again Dismounted!
|
#6
|
||||
|
||||
![]()
the reason i am trying to offset the timestamp is because I am attempting to write a calendar search modification, and the events will need to be searched for using unixtime, as offest to the user's timesone.
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|