Conversion from integer to time in ax 2012 - type-conversion

I have requirement where i find the type of field and then i show the value of that field,
I am using SysDictField.baseType() method to get the type of the field and table.(field) will give me the value but if the field type is Time and when i try to fetch the type using baseType() method it gives me as an Integer so it gives me value like 72000, 62000 etc.. instead of 6.00 PM, 7.00 AM etc..
I want to convert the integer value to Time type so i can display 6.00 PM, 7 AM. Please help me.

The AX TimeOfDay type is number of seconds from midnight.
You can use time2Str function or use div and mod operand to calculate hours and minutes.
Example:
info(time2Str(31501, TimeSeparator::Colon, TimeFormat::AMPM));

Related

Material date-time pickers and zoned time string problem

I have a page with #material-ui/pickers
<TimePicker .. value={value}/> /* value == 2020-12-24T13:05:10.714Z */
The value in the example is a zoned datetime string coming the from server.
My time zone is +2:00, Ukraine/Kiev.
The problem is that rendered time is 15:05. Is this behaviour normal when input value is zoned datetime?
I would like to see 13:05. Is this the server that provides me with incorrect datetime format or is it me misusing #meterial/pickers and #date-fns ?
2020-12-24T13:05:10.714Z is an ISO-8601 datetime string. The suffix Z means that the time is in UTC (see wikipedia). The rendered time of 15:05 in your +02:00 zone matches that.
So yes, if your server meant to specify 13:05 Kiev time, it's using the wrong format or the wrong time. It should say 2020-12-24T11:05:10.714Z or 2020-12-24T13:05:10.714+02:00.

Getting the Age using Parameter Value and Current Date [CRYSTAL REPORT]

I'm trying to get the age of my user in crystal report using parameter and current date.
This is my formula for the crystal report.
INT ((CurrentDate - {?txtbdate}) / 365.25)
For example: the date in {?txtbdate} is 1996-07-29 and today
is 2018-10-25.
The age must be 22.
When I execute it, a popup message appear saying "A number is required here."
This is just a blind guest, but you must first convert the data before doing the math,
For ex. (INT (CurrentDate) - INT ({?txtbdate})) / 365.25
each value must be Identified as integer before subtracting
The Right way of doing it:
you can use the DateDiff function on the
ex. DateDiff("yyyy", CurrentDate, {?txtbdate})

datetime/day finance/day conflict

I am trying to use the day function in datetime as
day(dateserial, 'dayofyear')
instead the function day from finance package is called giving me day of month because there is a day function with a similar signature.
I couldn't find in the documentation how to distinguish same function names. I find recommendations on the internet saying I should remove package from path but that's absurd as these are standard MATLAB packages.
example:
day(now,'dayofyear')
Warning: Unless the first input argument is a date character vector, all subsequent arguments will be ignored.
In datevec (line 67)
In day (line 39)
ans =
23
It seems date and datetime are not compatible.
The function day in the finance toolbox take a serial date or character vector as an input. For example:
day(datenum(now));
The function day that you want takes a datetime array as an input.
day(datetime(2017,02,23,01,06,00), 'dayofyear');
ans =
54
Matlab uses the input type to determine which function to use.
Your input to day() needs to be a datetime (not a number). If it's a datetime then it will call the day() function/method that applies to datetimes.
dt = datetime( datevec(now) )
day(dt, 'dayofyear')

Create date from day, month, year as integers in KDB Q

I am trying to get a date from its integer components: I have day, month and year as variables (that can change, I don't want to hard code them), and I want to reunite them in a date variable.
For example, something like that;
myDay: 15
myMonth: 4
myYear: 2016
`date$(myYear,myMonth,myDay) --> should return 2016.4.15 (formatted as a date).
Any way to do that?
Thank you
q)d:3
q)m:8
q)y:2016
q)"D"$"." sv string (y;m;d)
2016.08.03
See cast vs tok - need to use different arguments depending on if what you're casting from is a string or not

Symfony2: Form specify range of Date

I use date and datetime widget into my formular, but the default values doen't suit me.
I don't know how to specify a date range into my ObjectType.
on the one hand I want to change date to specify a date range:
for example
- from 2012-10-1 to 2022-10-1
On the other hand I want to specify the minutes like that
0 - 10 - 20 -30-40 - 50
Please help me
See ya
Sam
Just symply precise in the type 'years' value, and it will be ok :)