NSIS-Date plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.)
m (Updated author links.)
Line 1: Line 1:
{|align=right
|<small>Author: [[{{ns:2}}:Afrow UK|Afrow UK]] ([[{{ns:3}}:Afrow UK|talk]], [[{{ns:-1}}:Contributions/Afrow UK|contrib]])</small>
|}
<br style="clear:both;">
== Recommendation ==
== Recommendation ==
Getting the local time is also possible using Windows API. Using this alternative method is recommended, because NSIS-Date seems to have some problems with timezones/summertime. See [[Get Current Time]].
Getting the local time is also possible using Windows API. Using this alternative method is recommended, because NSIS-Date seems to have some problems with timezones/summertime. See [[Get Current Time]].
Line 37: Line 41:
MessageBox MB_OK "Date=$0" </highlight-nsis>
MessageBox MB_OK "Date=$0" </highlight-nsis>
Thanks [[user:Rainwater|Rainwater]]!
Thanks [[user:Rainwater|Rainwater]]!
Page author: [[User:Afrow UK|Afrow UK]]

Revision as of 03:00, 30 April 2005

Author: Afrow UK (talk, contrib)


Recommendation

Getting the local time is also possible using Windows API. Using this alternative method is recommended, because NSIS-Date seems to have some problems with timezones/summertime. See Get Current Time.

Links

nsisdt.zip (4 KB)

Description

This plugin allows you to insert the date and / or time anywhere into your installer.

Plugin Readme

NSIS-Date 1.0
Copyright (C) 2001 Robert Rainwater <rrainwater@yahoo.com>
This software is provided 'as-is', without any express or implied
warranty.  In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Usage Information
-----------------
Step 1:
	Generate a format string using the following:
	    %a    abbreviated weekday name (Sun)
	    %A    full weekday name (Sunday)
	    %b    abbreviated month name (Dec)
	    %B    full month name (December)
	    %c    date and time (Dec  2 06:55:15 1979)
	    %d    day of the month (02)
	    %H    hour of the 24-hour day (06)
	    %I    hour of the 12-hour day (06)
	    %j    day of the year, from 001 (335)
	    %m    month of the year, from 01 (12)
	    %M    minutes after the hour (55)
	    %p    AM/PM indicator (AM)
	    %S    seconds after the minute (15)
	    %U    Sunday week of the year, from 00 (48)
	    %w    day of the week, from 0 for Sunday (6)
	    %W    Monday week of the year, from 00 (47)
	    %x    date (Dec  2 1979)
	    %X    time (06:55:15)
	    %y    year of the century, from 00 (79)
	    %Y    year (1979)
	    %Z    time zone name, if any (EST)
	    %%    percent character %
Step 2:
	Call currentdate
Step 3:
	The current date is returned into $0.

Example:
File /oname=$TEMP
sisdt.dll nsisdt.dll
StrCpy $0 "%Y.%m.%d-%H.%M"
CallInstDLL "$TEMP
sisdt.dll" currentdate
MessageBox MB_OK "Date=$0"

Thanks Rainwater!