Jump to content

date calculation

Recommended Posts


So I get:

$aMatch[0] Date(1499295600000)   this is supposed to be 06 Jul 2017
$aMatch[0] Date(1483574400000)  this is supposed to be 05 Jan 2017

does anybody know the formula to calculate the date from the large number?  It doesn't seem to be anything to do with DateToDayValue.

thanks in advance.

Edited by Jury

Share this post

Link to post
Share on other sites

Where is this number coming from? It's almost, but not quite, the number of seconds since Epoch time (1970/01/01 00:00:00) but with too many zeros.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post

Link to post
Share on other sites

@BrewManNH its Unix time in milliseconds.

Share this post

Link to post
Share on other sites

Is there a formula? (not that I'd understand it)  I see in the script there is:

"dateTimeFormat":{"AMDesignator":"AM","AbbreviatedDayNames":["S","M","T","W","T","F","S"],"AbbreviatedLeapMonthNames":null,"AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"Calendar":{"AlgorithmType":1,"CalendarType":1,"Eras":[1],"IsReadOnly":false,"MaxSupportedDateTime":"\/Date(253402300799999)\/","MinSupportedDateTime":"\/Date(-62135596800000)\/","TwoDigitYearMax":2029},"CalendarWeekRule":2,"DateSeparator":"\/","DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"FirstDayOfWeek":1,"FullDateTimePattern":"dd MMMM yyyy hh:mm tt","IsReadOnly":true,"LeapMonthNames":null,"LongDatePattern":"dd MMMM yyyy","LongTimePattern":"hh:mm tt","MonthDayPattern":"d MMMM","MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"NativeCalendarName":"Gregorian Calendar","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH':'mm':'ss 'GMT'","ShortDatePattern":"dd\/MM\/yyyy","ShortTimePattern":"hh:mm tt","ShortestDayNames":["S","M","T","W","T","F","S"],"SortableDateTimePattern":"yyyy'-'MM'-'dd'T'HH':'mm':'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy'-'MM'-'dd HH':'mm':'ss'Z'","YearMonthPattern":"MMMM yyyy","eras":[1,"A.D.","AD",0]}

oh boy!

Share this post

Link to post
Share on other sites

and now I've found it!


AutoIT _DateAdd("s", $EpochSeconds , "1970/01/01 00:00:00")


Share this post

Link to post
Share on other sites

now - how to use it for $EpochSeconds  to human readable date?

Share this post

Link to post
Share on other sites

there is a nice search tool on the forum


My resources are limited. You must ask the right questions


Share this post

Link to post
Share on other sites

So there is thank you - of course initially I didn't know 'unix' or 'epoch' etc.

Share this post

Link to post
Share on other sites

right. it always comes down to asking the right questions. you can always start somewhere and make progress, then refine your search.

It's all about clear, clean and concise information, and the efficient and effective dissemination of said information communicated to others. You should always put time and effort into making your questions as clear as possible. Include your source code with an explanation of what is not working. In these ways you will be rewarded with the right answers more quickly.

Edited by Earthshine

My resources are limited. You must ask the right questions


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Siryx
      By Siryx
      So what i need is a function that I pass a starting date into and it counts up to the current date. Example:
      How would I do that? I found the Date.au3 in the includes but I can't find anything close to a time object like I'm used to working with in Java. I just need some $date = setDate(2009-05-30) and from there I could just add a day every time. I need this to be in the very format I stated earlier and from what I can see everytime related to date and time is automatically changed to my german locale.
      €: I already tried setDate but instead it changed my PCs clock. Not quite what i was looking for  
    • nacerbaaziz
      By nacerbaaziz

      I have a question please
      How to show Islamic date in Autoit
      I mean
      for example
      Ramadan month
      And moharam month ... etc
      I hope my question is clear for you
      Thanks in advance
    • litlmike
      By litlmike
      I am taking a Date & Time and splitting them using _DateTimeSplit, so that I can create a filename in the format: YYYYMMDD_HHMMSS.jpg.  The only issue is that if the month, or day, is a two-digit number that begins with a zero (so less than 10), then the month, or day, is formatted as a single-digit number.  Suggestions on how to accomplish this?
      20180101 becomes 2018, 1, 1
      20180303 becomes 2018, 3, 3
      20180505 becomes 2018, 5, 5
      20180606 becomes 2018, 6, 6
      20180909 becomes 2018, 9, 9
      What I want:
      20180101 becomes 2018, 01, 01
      20180303 becomes 2018, 03, 03
      20180505 becomes 2018, 05, 05
      20180606 becomes 2018, 06, 06
      20180909 becomes 2018, 09, 09
      Func _CreateFileNameFromDateTimeFormat($sDateThatWasChangedIntoDateTimeFormat = "2018/01/02 10:29:39") Local $aMyDate, $aMyTime, $sNewImageFileName _DateTimeSplit($sDateThatWasChangedIntoDateTimeFormat, $aMyDate, $aMyTime) _ArrayDisplay($aMyDate) _ArrayDisplay($aMyTime) ;This will become file name $sNewImageFileName = $aMyDate[1] & $aMyDate[2] & $aMyDate[3] & "_" & $aMyTime[1] & $aMyTime[2] & $aMyTime[3] & ".jpg" ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sNewImageFileName = ' & $sNewImageFileName & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndFunc ;==>_CreateFileNameFromDateTimeFormat  
    • Shedunn
      By Shedunn
      I've been looking through some different functions(not sure if that's the right word) to get the Date and time and I can't find one that doesn't include "/ " or ":" in what is returned.

      I'm trying to create a file name with this format "QuickConfig_MMDDYYYY_HHMM"  (doesn't matter if 24 or 12hr format)
      #include <Date.au3> Func _SaveConfig MouseClick('primary',155, 46, 1, 0) ;clicks save as WinWait('Save bluePRINT Configuration As...','', 4) MouseClick('primary',632, 47, 1, 0) ;clicks the file path bar $Documents = @MyDocumentsDir $FilePath = $Documents & '\BP3 Configs' Send($FilePath) Send('{ENTER}') MouseClick('primary',166, 580, 1, 0) ;clicks file name bar $FileName = 'QuickConfig_' & _NowDate & '_' & _NowTime Send($FileName) Send('{ENTER}') EndFunc  
      I'm wondering if there is a function somewhere to do this?
    • ur
      By ur
      I have date in the string format as "DD-MM-YYYY".
      I need to get yesterday's date from it.
      I tried converting this from _DateTimeFormat but not working.
      Is there any direct UDF available to get this.?