
Quote from josevdr95 on February 10, 2023, 3:23 pmHola, desde hace unos días estoy jugando con el formato json pero me encontré un formato de fecha un poco diferente “1675815423075”. Como puedo convertirlo a un formato de fecha clásico. ¿Se necesita algún plugin un es un procediendo que se puedes hacer mediante cálculos?
Hola, desde hace unos días estoy jugando con el formato json pero me encontré un formato de fecha un poco diferente “1675815423075”. Como puedo convertirlo a un formato de fecha clásico. ¿Se necesita algún plugin un es un procediendo que se puedes hacer mediante cálculos?
Uploaded files:Quote from Gaev on February 10, 2023, 4:31 pm@josevdr95
How can I convert it to a classic date format.
Take a look at the NumToDate command ...
https://winhelp.visualneo.com/Control.html#NUMTODATE
How can I convert it to a classic date format.
Take a look at the NumToDate command ...

Quote from josevdr95 on February 10, 2023, 5:04 pm@gaev
Si ya he probado NumToDate "1675815423075" "yy/mm/dd" "[resul]" pero creo que no devuelve el valor correcto sin envergo he probado https://www.online-toolz.com/tools/date-functions.php y me devuelve otro resultado que creo que es el correcto.
Si ya he probado NumToDate "1675815423075" "yy/mm/dd" "[resul]" pero creo que no devuelve el valor correcto sin envergo he probado https://www.online-toolz.com/tools/date-functions.php y me devuelve otro resultado que creo que es el correcto.
Uploaded files:Quote from Gaev on February 10, 2023, 5:44 pm@josevdr95
Yes I have already tried NumToDate "1675815423075" "yy/mm/dd" "[resul]" but I think it does not return the correct value however I have tried https://www.online-toolz.com/tools/date-functions. php and it returns another result that I think is correct.
VisualNEOWin's numbers represent the number of DAYS since December/30 1899 ... most other systems store numbers as the number of MILLISECONDS that have elapsed since 1 January 1970 at 00:00:00.
Looks like the number you are looking at might be in MILLISECONDS ... take a look at this javascript ...
https://www.w3schools.com/js/js_date_methods.asp
... if the try-out-samples give you the expected results, and you don't have the knowledge to develop Javascript Functions, ask for help here.
Yes I have already tried NumToDate "1675815423075" "yy/mm/dd" "[resul]" but I think it does not return the correct value however I have tried https://www.online-toolz.com/tools/date-functions. php and it returns another result that I think is correct.
VisualNEOWin's numbers represent the number of DAYS since December/30 1899 ... most other systems store numbers as the number of MILLISECONDS that have elapsed since 1 January 1970 at 00:00:00.
Looks like the number you are looking at might be in MILLISECONDS ... take a look at this javascript ...
https://www.w3schools.com/js/js_date_methods.asp
... if the try-out-samples give you the expected results, and you don't have the knowledge to develop Javascript Functions, ask for help here.

Quote from josevdr95 on February 10, 2023, 6:29 pm@gaev
<script> const d = new Date(1675815423075); document.getElementById("demo").innerHTML = d; </script>Resultado:
Tue Feb 07 2023 19:17:03 GMT-0500 (hora estándar oriental)
Si me devolvió el resultado correcto ahora la pregunta seria como adaptar eso a visualneo win. Gracias de antemano muy atentos e inteligentes todos.
<script>
const d = new Date(1675815423075);
document.getElementById("demo").innerHTML = d;
</script>
Resultado:
Tue Feb 07 2023 19:17:03 GMT-0500 (hora estándar oriental)
Si me devolvió el resultado correcto ahora la pregunta seria como adaptar eso a visualneo win. Gracias de antemano muy atentos e inteligentes todos.
Quote from Gaev on February 10, 2023, 6:48 pm@josevdr95
Later today, I will develop, test and upload a Javascript Function that you cab Call; it will return the required result in a neo variable.
Later today, I will develop, test and upload a Javascript Function that you cab Call; it will return the required result in a neo variable.
Quote from Gaev on February 11, 2023, 5:33 am@josevdr95
I have managed to create the necessary (javascript) Function; however, it looks like the resulting format of the Text String can vary slightly according to the Windows settings of the host computer.
I think it will be better if I further enhance it so the different components will be returned in separate variables e.g. something like ...
Call "gkDateNumToString" "[myDateNumber]" "[myFullYear]" "[myMonthOfYear]" "[myDayOfMonth]" "[myHour]" "[myMinute]" "[mySecond]" "[myTimeOffset]" "[myDayOfWeek]"
... is that sufficient ?
I have managed to create the necessary (javascript) Function; however, it looks like the resulting format of the Text String can vary slightly according to the Windows settings of the host computer.
I think it will be better if I further enhance it so the different components will be returned in separate variables e.g. something like ...
Call "gkDateNumToString" "[myDateNumber]" "[myFullYear]" "[myMonthOfYear]" "[myDayOfMonth]" "[myHour]" "[myMinute]" "[mySecond]" "[myTimeOffset]" "[myDayOfWeek]"
... is that sufficient ?

Quote from Gaev on February 11, 2023, 8:03 pm@josevdr95
I have attached the Function file that you should save in the VisualNEOWin Functions folder; then remove the file extension; these files can not have an extension, and this forum does not let me upload files without an extension).
You can then test it using script commands (associated with a button click) like so ...
SetVar "[thisDateNum]" "1675815423075" Call "gkDateNumToString" "[thisDateNum]" "[utcString]" "[zoneOffset]" "[localeString]" SetVar "[dateResults]" "[thisDateNum][#13][#10]UTC String = [utcString]" SetVar "[dateResults]" "[dateResults][#13][#10]Zone Offset = [zoneOffset]" SetVar "[dateResults]" "[dateResults][#13][#10]Locale String = [localeString]" AlertBox "gkDateNumToString says ..." "[dateResults]"Please test and report your experience.
Later, I will release additional Functions ...
a) gkDateNumToValues (fullYear, monthOfYear, dayOfMonth, dayOfWeek) with options to request base of zero/one for dayOfMonth and dayOfWeek
b) gkTimeNumToValues (hour, minute, seconds, milliseconds) with options to request AM/PM or 24 hour formats
I am also hoping to support options to request UTC or locale values.
I have attached the Function file that you should save in the VisualNEOWin Functions folder; then remove the file extension; these files can not have an extension, and this forum does not let me upload files without an extension).
You can then test it using script commands (associated with a button click) like so ...
SetVar "[thisDateNum]" "1675815423075" Call "gkDateNumToString" "[thisDateNum]" "[utcString]" "[zoneOffset]" "[localeString]" SetVar "[dateResults]" "[thisDateNum][#13][#10]UTC String = [utcString]" SetVar "[dateResults]" "[dateResults][#13][#10]Zone Offset = [zoneOffset]" SetVar "[dateResults]" "[dateResults][#13][#10]Locale String = [localeString]" AlertBox "gkDateNumToString says ..." "[dateResults]"
Please test and report your experience.
Later, I will release additional Functions ...
a) gkDateNumToValues (fullYear, monthOfYear, dayOfMonth, dayOfWeek) with options to request base of zero/one for dayOfMonth and dayOfWeek
b) gkTimeNumToValues (hour, minute, seconds, milliseconds) with options to request AM/PM or 24 hour formats
I am also hoping to support options to request UTC or locale values.
Uploaded files:

Quote from josevdr95 on February 11, 2023, 10:09 pm@gaev
¡Valla funciona correctamente! Excelente esto es una muestra de que gracias a “Call” no hay límites. Gracias esto nos va ayudar mucho a todos ya parece que ese formato está de moda, la mayoría de los json que trabajo me devuelven la fecha en ese formato.
¡Valla funciona correctamente! Excelente esto es una muestra de que gracias a “Call” no hay límites. Gracias esto nos va ayudar mucho a todos ya parece que ese formato está de moda, la mayoría de los json que trabajo me devuelven la fecha en ese formato.
Quote from Gaev on February 12, 2023, 3:02 am@josevdr95
I have attached the file for VisualNEOWin Function called gkDateNumToLocaleDateParts.
As before, please remove the file extension after saving it in the VisualNEOWin Functions folder.
Then, you can try something like this ...
SetVar "[thisDateNum]" "1675815423075" Call "gkDateNumToLocaleDateParts" "[thisDateNum]" "1" "[fullYear]" "[monthNumber]" "[dayOfMonth]" "[dayOfWeek]" SetVar "[thisDateParts]" "DateNum = [thisDateNum][#13][#10]FullYear = [fullYear][#13][#10]Month Number = [monthNumber][#13][#10]" SetVar "[thisDateParts]" "[thisDateParts]Day Of Month = [dayOfMonth][#13][#10]Day of Week = [dayOfWeek]" AlertBox "gkDateNumToComps says ..." "[thisDateParts]"Note:
1) Javascript returns the 'Month Number' values as 0 (January), 1 (February) etc. ... this helps to translate numbers to words using Javascript Arrays .. but not developers/users of VisualNEOWin ... so, you can specify the base (starting month number) ... if it is not specified as 1, then it defaults to base of 0
2) Javascript returns the 'Day of Week Number' as 0 (Sunday), 1 (Monday) etc. ... I am told that in some countries, Monday is considered the first day of the week.
Please test/validate this Function using as many different numbers as possible, and report any errors/omissions.
In the mean time, I will work on a similar function to obtain the different parts of the Time component.
I have attached the file for VisualNEOWin Function called gkDateNumToLocaleDateParts.
As before, please remove the file extension after saving it in the VisualNEOWin Functions folder.
Then, you can try something like this ...
SetVar "[thisDateNum]" "1675815423075" Call "gkDateNumToLocaleDateParts" "[thisDateNum]" "1" "[fullYear]" "[monthNumber]" "[dayOfMonth]" "[dayOfWeek]" SetVar "[thisDateParts]" "DateNum = [thisDateNum][#13][#10]FullYear = [fullYear][#13][#10]Month Number = [monthNumber][#13][#10]" SetVar "[thisDateParts]" "[thisDateParts]Day Of Month = [dayOfMonth][#13][#10]Day of Week = [dayOfWeek]" AlertBox "gkDateNumToComps says ..." "[thisDateParts]"
Note:
1) Javascript returns the 'Month Number' values as 0 (January), 1 (February) etc. ... this helps to translate numbers to words using Javascript Arrays .. but not developers/users of VisualNEOWin ... so, you can specify the base (starting month number) ... if it is not specified as 1, then it defaults to base of 0
2) Javascript returns the 'Day of Week Number' as 0 (Sunday), 1 (Monday) etc. ... I am told that in some countries, Monday is considered the first day of the week.
Please test/validate this Function using as many different numbers as possible, and report any errors/omissions.
In the mean time, I will work on a similar function to obtain the different parts of the Time component.
Uploaded files: