Jump to content

Trying to get original file date and time with seconds in the result


Champak
 Share

Recommended Posts

I'm trying to get the date and time a video file was originally taken so I'm using _FileGetProperty from BrewMan. The problem is I don't see seconds in any of the date properties. But when I use _Date_Time_GetFileTime, it has seconds on all of the date properties. Does someone know another UDF that will give me media created, acquired date, or date property with seconds in the time?

And just out of curiosity, how does the same property produce two different results between the two UDFs?

 

Thanks.

Link to comment
Share on other sites

Are you referring to the file created time or metadata, for file you can just use the builtin FileGetTime example:

;~ Get Created Timestamp
Local $aFileDate = FileGetTime(@ScriptFullPath, 1, 0)
MsgBox(4096, "FileDate", "Year : " & $aFileDate[0] & @CRLF & "Month : " & $aFileDate[1] & @CRLF & "Day : "  & $aFileDate[2] & @CRLF & "Hour : " & $aFileDate[3] & @CRLF & "Minutes : " & $aFileDate[4] & @CRLF & "Seconds : " & $aFileDate[5])

 

Link to comment
Share on other sites

39 minutes ago, Subz said:

Are you referring to the file created time or metadata ... ?

Considering the post counter of @Champak , I would guess that it is more about metadata :think: .

@Champak : Not my area of expertise at all, but would external software, such as ExifTool , be a conceivable solution ?

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

@Musashi you're correct, just re-read the OP, not enough zzz

You could use the ExtendedProperty to capture the created date, example:

;~ Melba23: Date_Time_Convert UDF
;~ Download: https://www.autoitscript.com/forum/topic/154684-date_time_convert-bugfix-version-27-may-15/
#include <DTC.au3>

Local $oShell = ObjCreate("Shell.Application")
Local $sFile = "MediaFile.MOV"
Local $sFolder = "C:\MediaFiles\"
Local $oFolder = $oShell.NameSpace($sFolder)
Local $oFolderItem = $oFolder.Parsename($sFile)
Local $sDateEncoded = $oFolderItem.ExtendedProperty("System.Media.DateEncoded")
ConsoleWrite($sDateEncoded & @CRLF)
Local $sDateFormated = _Date_Time_Convert($sDateEncoded, "yyyyMMddHHmmss", "yyyy/MM/dd hh:mm:ss")
MsgBox(4096, $sFile & " Media Created Date", "Media Created : " & $sDateFormated)

 

Edited by Subz
Link to comment
Share on other sites

 

@Musashi, I looked at different Exif tools, but I need something that can batch process random names that need to be programmed and I can't be bothered to learn another language or program to write whatever will be needed. If it was one or two files with a couple variations I would go with an Exif tool.

@Subz thanks, but I already went a different route. I used the _FileGetProperty and just used the loop variable within the function to append the count to the end to use as seconds. Didn't really matter if the seconds were accurate, only needed to differentiate videos that might have been recorded within the same minute so I don't end up with duplicate files.

I do have another matter however. In renaming the files using filemove, I end up with a new date created. Is there anyway to preserve the original date created? Or a different method of renaming a file that wont change that?

Thanks.

Link to comment
Share on other sites

Link to comment
Share on other sites

13 hours ago, Champak said:

I looked at different Exif tools, but I need something that can batch process random names that need to be programmed and I can't be bothered to learn another language or program to write whatever will be needed.

Just for the sake of completeness. The ExitTool is apparently also available as a standalone for Windows, usable via commandline parameters, see :   https://exiftool.org/

Excerpt :

Spoiler
Windows Executable: exiftool-12.36.zip (6.4 MB)

The stand-alone Windows executable does not require Perl. Just download and un-zip the archive then double-click on "exiftool(-k).exe" to read the application documentation, drag-and-drop files and folders to view meta information, or rename to "exiftool.exe" for command-line use. Runs on all versions of Windows.

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

@Nine great idea, I don't know how my eyes overshot that, I didn't think to look for that because I thought only mp3 properties could be changed. So since that is possible, is it possible to change any of the other meta data/extended properties in a video file? I did a search and it seems the last time someone could do it was pre win10.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...