vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need some help turning string into time (https://vborg.vbsupport.ru/showthread.php?t=35246)

JJR512 02-20-2002 06:51 AM

Suppose you have this string: 200754

The first two digits are today's day of the month (as in Feb. 20). The next two digits are the hour of the day in 24-hour format, and the final two digits are the minutes of the hour (the time in that string is 07:54).

The time zone will always be GMT for the string.

How can this be converted to vBulletin's date/time format, which is something like "1014047921".

BTW, is Zulu or UTC the same time as GMT?

JJR512 02-20-2002 06:57 AM

Hmm...I think I just realized how to split apart the string.
PHP Code:

preg_match("/([0-9]{2})([0-9]{2})([0-9]{2})"/,200754,$matches

That ought to split it apart into three pairs of two digits, right? And each pair is identified by $matches[1] or 2 or 3.

That just leaves converting the numbers into vB's format...

Admin 02-20-2002 12:16 PM

You can't do what you are trying to do, because your string misses the year and month indications. And since vBulletin uses the Unix timestamp, you must have those...

JJR512 02-21-2002 01:35 AM

Sorry, I forgot to explain more.

The month and year should be assumed to be the present.

The time format 200754Z is part of a report that gets published about every hour or so. So it is conceivable that someone just after midnight of the last day of the month could be looking at a report that is from last month. There will need to be some code that checks for that kind of thing.

Radon3k 02-21-2002 02:13 AM

JJR512, I can't help you with your PHP problems, but I can tell you that GMT, Zulu, and UTC are all the same time ;)


All times are GMT. The time now is 08:31 AM.

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.00980 seconds
  • Memory Usage 1,715KB
  • 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
  • (5)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