Raised This Month: $32 Target: $400
 8% 

How many times are ..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PawnerBros
Junior Member
Join Date: Aug 2016
Old 11-04-2017 , 19:24   How many times are ..
Reply With Quote #1

Hi! I have a problem.
I have variables:
new iHour, iMin, iSec;
new iYear, iMonth, iDay;
How can i make a system that if the variable iMin has a value of 1510 (1440 = 1 day) = 1510 = 1 day, 1 hour, 10 minutes
How do I make it 1 day, 1 hour and 10 minutes write to the variables?

Last edited by PawnerBros; 11-04-2017 at 19:25.
PawnerBros is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 11-04-2017 , 19:34   Re: How many times are ..
Reply With Quote #2

iDay = floatround(iMin / 1440, floatround_floor)
iHour = floatround(iMin / 60, floatround_floor)
iMin = iMin % 60
__________________
Airkish is offline
PawnerBros
Junior Member
Join Date: Aug 2016
Old 11-04-2017 , 19:37   Re: How many times are ..
Reply With Quote #3

Thank you!
PawnerBros is offline
PawnerBros
Junior Member
Join Date: Aug 2016
Old 11-04-2017 , 19:39   Re: How many times are ..
Reply With Quote #4

And I have a question as to how it works, ie when the minutes will be less than 1440, so will it add to iday 0?
+
I made this:
iEndTime = iHour + ":" + iMin + ":" + iSec;
And so I write it into the database.
You can tell me how to do it
iEndTime = iHour + ":" + iMin + ":" + iSec;
then when I read it from the database it will format:
iReadedTime = 120:10;
How do I get it to write again iHour, iMin, iSec?

Last edited by PawnerBros; 11-04-2017 at 19:55.
PawnerBros is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 11-05-2017 , 02:31   Re: How many times are ..
Reply With Quote #5

Spoiler

Are you looking for something like this?
__________________

Last edited by Relaxing; 11-05-2017 at 07:20.
Relaxing is offline
PawnerBros
Junior Member
Join Date: Aug 2016
Old 11-05-2017 , 06:29   Re: How many times are ..
Reply With Quote #6

No i need this:,
iReadedTime = 12:10:41; this 12 add to ihours, 10 add to iminutes, and 41 add to isec.
PawnerBros is offline
PawnerBros
Junior Member
Join Date: Aug 2016
Old 11-05-2017 , 11:03   Re: How many times are ..
Reply With Quote #7

BUMP
PawnerBros is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-05-2017 , 12:15   Re: How many times are ..
Reply With Quote #8

Bump within 5 hours of the last post?! I wanted to help, but now I changed my mind.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-05-2017 , 13:11   Re: How many times are ..
Reply With Quote #9

You cannot represent the colon-format of time as an integer, it can only be represented as a string. You need to explain better what you are actually trying to do. How is it stored in the database and how are you needing to use it?

If you have it as a string then you need to parse the string and extract the individual integers (get each of the numbers into their own string using strtok() and convert those to integers).

P.S. Don't use what Airkish posted, it is wrong.
__________________
fysiks is offline
PawnerBros
Junior Member
Join Date: Aug 2016
Old 11-05-2017 , 13:57   Re: How many times are ..
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
You cannot represent the colon-format of time as an integer, it can only be represented as a string. You need to explain better what you are actually trying to do. How is it stored in the database and how are you needing to use it?

If you have it as a string then you need to parse the string and extract the individual integers (get each of the numbers into their own string using strtok() and convert those to integers).

P.S. Don't use what Airkish posted, it is wrong.
And can you tell me how to do it when what he wrote is bad?
Can you please tell me how to use the strtok() function?

Last edited by PawnerBros; 11-05-2017 at 14:00.
PawnerBros is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode