PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → [WM23] Mask for Date time on Android
[WM23] Mask for Date time on Android
Débuté par ARV, 14 déc. 2018 17:53 - 6 réponses
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 14 décembre 2018 - 17:53
Hi all

I have an edit with date time for my type of data but I want to show something like 1:00 p.m. and not 13:00,
I change the mask for do that but it only put something like 1:00 AP and it's not possible to set it like 1:00 p.m.

this is what I put on my mask for my edit:
DD/MM/YYYY HH:mm AP

I change the parameters for the description of the project and set what I want for my AM and PM symbol and nothing seems to work

anyone have an idea why?

Thanks!

--
Best Regards
ARV
Membre enregistré
19 messages
Posté le 14 décembre 2018 - 21:05
Shouldn't the last two letters in your mask be AM, not AP?

--
Vincent D Crosby
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 15 décembre 2018 - 16:47
Hi Mister

Thanks for your reply

well maybe the AP it was use it for PC and it works, I will change it to AM just to see if works on my mask

Thanks!

--
Best Regards
ARV
Posté le 21 décembre 2018 - 16:40
I correct myself. I went ahead and changed the mask ending with AP and found that, at least on the PC, it is displaying correctly. If the AM does not solve your problem and AP (as you have stated) doesn't work, then perhaps someone else may have an answer for you.

I apologize if I steered you in the wrong direction.
Posté le 28 décembre 2018 - 17:57
ARV,

I have found what you have. The mask simply doesn't work.
I had to display it programatically.

I wrote a procedure for it.


// Summary: <convert time to AM PM format>
//[ <Result> = ] Time_Modify (<sDateTime> is string)
// Parameters:
// sDateTime (UNICODE string): <specify the role of sDateTime>
// Return Value:
// UNICODE string: // None
// dateTime (UNICODE string): <specify the role of dateTime>
PROCEDURE Time_Modify(sDateTime is string)

temp is string
sTime is string
tTime is Time
sDate is string

sDate = Left(sDateTime,10)
sTime = Right(sDateTime,5)
tTime = StringToTime(sTime,"HH:MM")

IF tTime..Hour >= 13 THEN

tTime..Hour = tTime..Hour - 12
temp = sDate + " " + TimeToString(tTime,"HH:MM") + " PM"

ELSE IF tTime..Hour = 12 THEN
temp = sDate + " " + TimeToString(tTime,"HH:MM") + " PM"

ELSE
temp = sDate + " " + TimeToString(tTime,"HH:MM") + " AM"

END

RESULT temp



Jim
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 02 janvier 2019 - 16:07
Hi all

Vinny C wrote:
I correct myself. I went ahead and changed the mask ending with AP and found that, at least on the PC, it is displaying correctly. If the AM does not solve your problem and AP (as you have stated) doesn't work, then perhaps someone else may have an answer for you.

I apologize if I steered you in the wrong direction.


Don't worry Vinny, some one will be appear with the answer

Jim wrote:
ARV,

I have found what you have. The mask simply doesn't work.
I had to display it programatically.

I wrote a procedure for it.


// Summary: <convert time to AM PM format>
//[ <Result> = ] Time_Modify (<sDateTime> is string)
// Parameters:
// sDateTime (UNICODE string): <specify the role of sDateTime>
// Return Value:
// UNICODE string: // None
// dateTime (UNICODE string): <specify the role of dateTime>
PROCEDURE Time_Modify(sDateTime is string)

temp is string
sTime is string
tTime is Time
sDate is string

sDate = Left(sDateTime,10)
sTime = Right(sDateTime,5)
tTime = StringToTime(sTime,"HH:MM")

IF tTime..Hour >= 13 THEN

tTime..Hour = tTime..Hour - 12
temp = sDate + " " + TimeToString(tTime,"HH:MM") + " PM"

ELSE IF tTime..Hour = 12 THEN
temp = sDate + " " + TimeToString(tTime,"HH:MM") + " PM"

ELSE
temp = sDate + " " + TimeToString(tTime,"HH:MM") + " AM"

END

RESULT temp



Jim



Hi Jim.

Ok I will try with this procedure thanks for your answer!


Thanks to all and the replys every information it's useful!

--
Best Regards
ARV
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 08 mars 2019 - 22:07
Hi all

reviving this thread

Here's a solution for this problem on this source:
https://forum.pcsoft.fr/en-US/pcsoft.us.windevmobile/2514-sorting-date-time-column-table-android-2522/read.awp

works on Android and iPhone too! check it out!

--
Best Regards
ARV