vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   time now, timezone's questions (https://vborg.vbsupport.ru/showthread.php?t=226936)

MyPornLife.info 10-28-2009 03:16 AM

time now, timezone's questions
 
hey
in a custom page, when someone add something (maybe a comment system), it adds to database current server time using TIMENOW
on my server..time zone is GMT +07.00
so it add to mysql db that +7 time

now the problem is...when that time retrives from DB it shows time in that +7 format
no matter if the user's timezone is GMT or GMT -5 or anything. it always show time +7 format.

example- if an artical is added at 10.00am (GMT)...it will be add in database like 5.00pm (as my server is +7 )

then if a user (who is using GMT-5) browse that comment next day...he sees Added on yesterday at 5.00pm (but he shud see 5.00am as he is using gmt-5)


now how can i solve it? ....(i cant change server time)

i heard about vbdate function although i dont know anything about it. it might be useful.

ps: DST also shud be worked

Lynne 10-28-2009 03:54 AM

Dates are stored as Unix timestamps in the database. So, when you get the date/time out of the database, you need to do something to it to make it into a date and time and in the current zone of the person viewing the page. That is where vbdate comes in. You should look the function up in the API to see what it does (under Quick Links).

MyPornLife.info 10-28-2009 08:08 AM

ya ya ya. i know that very well. & i tried vbdate(). it can convert UNIX timestamp to normal like php date() function.
but thats not my problem
i want to include user's (current user) timezone here with DST setting
& the API cannot explain much about it (coz i tried & failed)
so kindly giv me some example codes here plz

--------------- Added [DATE]1256721711[/DATE] at [TIME]1256721711[/TIME] ---------------

nevermind...i solved it

--------------- Added [DATE]1256722111[/DATE] at [TIME]1256722111[/TIME] ---------------

just another question

PHP Code:

vbdate($vbulletin->options['dateformat'], $timetrue);
vbdate($vbulletin->options['timeformat'], $time); 

to get time & date...i had to use those two lines
is there any way to get that same result with a single line (command) ??

Lynne 10-28-2009 03:19 PM

You must use the two lines like you are using in order to get the time & date.


All times are GMT. The time now is 11:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00909 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete