Hi,
I have the following doubts with regard to handling date and time in b4A:
1) I have to perform the following validation:
If input Date=System Date then
the input time should not be within 1 hour from the system time
i.e. if the input date equals the system date and the current time is 11:30 am then the input time should
be greater than or equal to 12:30 pm...
For date comparison we can use the
DateTime.Date(lnginputDate)=DateTime.Date(lngsystemDate)
{Where lnginputDate=Datetime.DateParse(inputdate)
and lngSystemDate=Datetime.DateParse(DateTime.Now) }
For hour difference we can use
Dim PerDiff as Period
PerDiff=DateUtils.PeriodBetween(Datetime.DateParse(inputDate),DateTime.now)
Log("Difference in Minutes:" & Perdiff.Minutes)
However, I have my input date as a string in dd-mm-yyyy hh:mm format ,for example: 21-02-2022 11:10
And DateTime.DateFormat = "dd-MM-yyyy hh:mm" is not acceptable.
So how can we do the above comparison in such case ?
2) In SQLLITE (and via DateTime/DateUtils), how does one display the date 21-02-2022 21:05 as
as 21-Feb-2022 9:05 pm ?
Require some assistance on the above.
Thanks..
I have the following doubts with regard to handling date and time in b4A:
1) I have to perform the following validation:
If input Date=System Date then
the input time should not be within 1 hour from the system time
i.e. if the input date equals the system date and the current time is 11:30 am then the input time should
be greater than or equal to 12:30 pm...
For date comparison we can use the
DateTime.Date(lnginputDate)=DateTime.Date(lngsystemDate)
{Where lnginputDate=Datetime.DateParse(inputdate)
and lngSystemDate=Datetime.DateParse(DateTime.Now) }
For hour difference we can use
Dim PerDiff as Period
PerDiff=DateUtils.PeriodBetween(Datetime.DateParse(inputDate),DateTime.now)
Log("Difference in Minutes:" & Perdiff.Minutes)
However, I have my input date as a string in dd-mm-yyyy hh:mm format ,for example: 21-02-2022 11:10
And DateTime.DateFormat = "dd-MM-yyyy hh:mm" is not acceptable.
So how can we do the above comparison in such case ?
2) In SQLLITE (and via DateTime/DateUtils), how does one display the date 21-02-2022 21:05 as
as 21-Feb-2022 9:05 pm ?
Require some assistance on the above.
Thanks..
Last edited: