Garry's Mod Wiki

Revision Difference

file.Time#528554

<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.⤶ * "GAME" Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)⤶ * "LUA" or "lsv" - All Lua folders (lua/) including gamesmodes and addons⤶ * "DATA" Data folder (garrysmod/data)⤶ * "MOD" Strictly the game folder (garrysmod/), ignores mounting.</arg>⤶ <arg name="gamePath" type="string">The path to look for the files and directories in. See <page text="this list">File_Search_Paths</page> for a list of valid paths.</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>⤶ </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></example>