Garry's Mod Wiki

Revision Difference

file.Time#515077

<function name="Time" parent="file" type="libraryfunc">⤶ <description>Returns when the file or folder was lasted modified in Unix time.</description>⤶ <realm>Shared and Menu</realm>⤶ <args>⤶ <arg name="path" type="string">The **file** or **folder** path.</arg>⤶ <arg name="gamePath" type="string">The game path to be used.&#xA;&#xA;* &quot;GAME&quot; Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)&#xA;* &quot;LUA&quot; or &quot;lsv&quot; - All Lua folders (lua/) including gamesmodes and addons&#xA;* &quot;DATA&quot; Data folder (garrysmod/data)&#xA;* &quot;MOD&quot; Strictly the game folder (garrysmod/), ignores mounting.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="number">Seconds passed since Unix epoch.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Prints out the last modified date of **file** helloworld.txt</description>⤶ <code>print( os.date("%d.%m.%Y", file.Time("helloworld.txt", "DATA") ) )</code>⤶ <output>04.08.2012</output>⤶ ⤶ </example>⤶ ⤶ ⤶ <example>⤶ <description>Prints out the last modified date of **folder** lua</description>⤶ <code>print( os.date( "%d.%m.%Y", file.Time( "lua", "GAME" ) ) )</code>⤶ <output>31.01.2016</output>⤶ ⤶ </example>