PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV Mobile 2024 → [WM23] Mask for Date time on Android
[WM23] Mask for Date time on Android
Started by ARV, Dec., 14 2018 5:53 PM - 6 replies
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on December, 14 2018 - 5:53 PM
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
Registered member
19 messages
Posted on December, 14 2018 - 9:05 PM
Shouldn't the last two letters in your mask be AM, not AP?

--
Vincent D Crosby
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on December, 15 2018 - 4:47 PM
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
Posted on December, 21 2018 - 4:40 PM
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.
Posted on December, 28 2018 - 5:57 PM
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
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on January, 02 2019 - 4:07 PM
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
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on March, 08 2019 - 10:07 PM
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