playMaker

Author Topic: [SOLVED] Time formatting  (Read 11254 times)

alternativee30

  • Playmaker Newbie
  • *
  • Posts: 24
[SOLVED] Time formatting
« on: July 09, 2012, 03:06:25 AM »
Regarding the following topic..
http://hutonggames.com/playmakerforum/index.php?topic=1711.0#lastPost

I want the user to be able to input a time format and then take that time formatted string and convert it back into seconds.

I can make individual inputs for Hours, Minutes and Seconds and do the math myself but i am wondering if there is a way to reverse the custom action for Seconds to String.
« Last Edit: July 12, 2012, 04:43:35 AM by Alex Chouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Time formatting
« Reply #1 on: July 09, 2012, 04:30:37 AM »
Hi,

 look into this:
http://hutonggames.com/playmakerforum/index.php?topic=1047.msg4332#msg4332

this should allow you to get what you want.

bye,

 Jean

alternativee30

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Time formatting
« Reply #2 on: July 09, 2012, 06:09:37 AM »
Hey,

The action works great. Only one thing i cant figure out.

I can get it to find the difference between the format
HH:mm
and
HH:mm


But i cant get it to convert
HH:mm:ss
and
HH:mm:ss



With a seconds spot it gives me a invalid format string.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Time formatting
« Reply #3 on: July 09, 2012, 08:08:11 AM »
Hi,

 you'll need to comply with the available format options.

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

If you can't find what you need, can you provide me with the exact output you expect, and I'll give it a go.

 bye,

 Jean

alternativee30

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Time formatting
« Reply #4 on: July 10, 2012, 05:13:10 AM »
I only need to take a string formatted in 00:00:00 for hours, minutes, and seconds and find the difference in time between it and 00:00:00.

So i need the result to be total seconds difference between 00:00:00 and 00:00:60 (my example string)

The float stored for my example would be 60 total seconds difference.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Time formatting
« Reply #5 on: July 10, 2012, 12:12:17 PM »
hi,

 ok, I see, so if it was 1 minute and 10 seconds you want to show 70 not 00:00:70 right ?

 bye,

 Jean

alternativee30

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Time formatting
« Reply #6 on: July 10, 2012, 07:26:20 PM »
Correct.

im using the stored seconds in the float variable for mathmatical equations then converting the seconds back to an understandable time string in HH:mm:ss.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Time formatting
« Reply #7 on: July 11, 2012, 03:58:34 AM »
Hi,

ok, got confused by this sorry. It's all working ok for me, see attached, I can use HH:mm:ss fine

if that doesn't work, it's likely that  the start or end date are not complying to that format. they need to be EXACTLY formated, else you will get that exception.

 bye,

 Jean

alternativee30

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Time formatting
« Reply #8 on: July 11, 2012, 05:10:30 AM »
hmm weird it works for me as well when i compare straight in the editor. the problem arises when i try to compare it to a string i have stored from getting the "text" property of a NGUI label.

I will mess with it some more and see if i cant find a solution.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Time formatting
« Reply #9 on: July 11, 2012, 05:44:57 AM »
hi,

 what exactly is the string you are inputing? Debug it on the console, then you'll know if that matches the format

 bye,

 Jean

alternativee30

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Time formatting
« Reply #10 on: July 12, 2012, 03:00:13 AM »
Doh... facepalm... cant believe it  :-\

it cant be 00:00:60

it has to be 00:01:00

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: [SOLVED] Time formatting
« Reply #11 on: September 15, 2014, 12:17:14 PM »
Can this approach factor in more then just days, to be truely calender accurate?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [SOLVED] Time formatting
« Reply #12 on: September 18, 2014, 09:29:45 AM »
Hi,

 Yep, with the correct format, it can.

 Bye,

 Jean

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: [SOLVED] Time formatting
« Reply #13 on: September 18, 2014, 04:07:29 PM »
This looks like it'll definitely help solve half my problem. However, it doesn't appear that that Minutes option is working for me, it's setup exactly like the other two that work fine. I've confirmed the format I'm using to add time is correct -

DD.HH:MM:SS

Any ideas?


mweyna

  • Full Member
  • ***
  • Posts: 242
Re: [SOLVED] Time formatting
« Reply #14 on: September 22, 2014, 02:29:24 AM »
Jean?