d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Yymmdd Function > Yearyear/monthmonth/dayday Function
Prev12
Add Reply New Topic New Poll
Member
Posts: 5,913
Joined: May 6 2009
Gold: 0.00
Oct 19 2013 07:02am
Quote (carteblanche @ Oct 19 2013 01:58pm)
where did 11 come from?


11 since "yymmdd-ssss" is 11 letters long..
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 19 2013 07:18am
Quote (bomben @ Oct 19 2013 09:02am)
11 since "yymmdd-ssss" is 11 letters long..


oh ok, your first post didn't include the -ssss part. regardless, what's wrong with azrad's code? obviously it's not complete, but it's a starting place for you.

This post was edited by carteblanche on Oct 19 2013 07:18am
Member
Posts: 10,812
Joined: Oct 15 2009
Gold: Locked
Warn: 20%
Oct 19 2013 11:44am
Yeah, you were lamenting that you were going to receive the data as a string, and clearly you need the months/years/day/(and now seconds) as separate integers so you can do some math with them. My snippet shows one method (I'm sure a serious c++ programmer can probably give you a better method) of getting that data converted into the integers you need.
Member
Posts: 5,913
Joined: May 6 2009
Gold: 0.00
Oct 19 2013 02:24pm
Quote (Azrad @ Oct 19 2013 06:44pm)
Yeah, you were lamenting that you were going to receive the data as a string, and clearly you need the months/years/day/(and now seconds) as separate integers so you can do some math with them. My snippet shows one method (I'm sure a serious c++ programmer can probably give you a better method) of getting that data converted into the integers you need.


its a birth id im looking for.. for example 900224-3333

90 = 1990
02 = february
24 = the 24th day

3333 = is the ID for the person...

I need to be able to check the third and fourth symbol so its in the range 1-12 since there is no 13th month :P and so on,, I hope you understand.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 19 2013 02:35pm
Quote (bomben @ Oct 19 2013 04:24pm)
its a birth id im looking for.. for example 900224-3333

90 = 1990
02 = february
24 = the 24th day

3333 = is the ID for the person...

I need to be able to check the third and fourth symbol so its in the range 1-12 since there is no 13th month  :P  and so on,, I hope you understand.


i think you're the one who's not understanding. no hatin'. read his code snippet again and try to understand what he's doing. maybe look up what substr and atoi do if you're not familiar with them.

This post was edited by carteblanche on Oct 19 2013 02:35pm
Go Back To Programming & Development Topic List
Prev12
Add Reply New Topic New Poll