18. januar 2000 - 13:43Der er
3 kommentarer og 1 løsning
Converting a Date to an Integer
(Konvertering af dato til heltal). I am aware that Microsoft has a conversion at least in Excel and I believe all MS applications that will let me transfer a date into a number (i.e. 8/7/1999 is number 36379 and 8/8/1999 is 36380 etc.) How can I set my program up to convert this date to a number? Or is there a 'secret' JavaScript function / method somewhere... (It is really needed to feed the right values to a complex COM-Obj.)
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
The idea was ok - but I need to convert the date from a format dd/mm/yyyy to an Integer - not just the 'dd' part...
f.ex. I found that in a COleDateTime this is defined as:
The DATE type is implemented as a floating-point value, measuring days from midnight, 30 December 1899. So, midnight, 31 December 1899 is represented by 1.0. Similarly, 6 AM, 1 January 1900 is represented by 2.25, and midnight, 29 December 1899 is – 1.0. However, 6 AM, 29 December 1899 is – 1.25.
Note To interpret the time portion, take the absolute value of the fractional part of the number.
The COleDateTime class handles dates from 1 January 100 – 31 December 9999.
Does a dual function in JavaScript to the COleDateTime in C++ exist?
<ole> I don\'t recall a JavaScript function to format time in that way, but if you can run ASP or PHP on your sever, you might be saved. PHP has a timestamp running from January 1. 1970 - so you would be able to simply once and for all calculate the number up til then and add to the timestamp. Then you could write in the HTML - or what ever. /Vh </bole>
var str = Date.parse(\"Aug 29, 2000\"); alert(str);
Will alert the number af milliseconds from Jan. 1. 1970. /Vh
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.