Jump to content
Sign in to follow this  

An insert date/time dialog

Recommended Posts


I am in the process of writing a very long script at the moment (Just past 2000 lines, does nothing), and this is one of the addons I have written for it. Although it is not neat, and could be more efficient, I am actually quite impressed with the outcome!

I based it on the insert date/time dialog I use with PSPad, and in some places I have made improvements, and in others not so much. I don't Think there are many features they have that I don't have here, and most of those will be present when I use the version designed for my code. This includes: Calculating the macros as you type, add + remove functions and memory. All of which I intend to build in, and I am also going to get the Help to work too, I have already written the helpfile section for this dialog in the project helpfile (Mostly copied off PSPad :))

My aims in this was to write it in 1 function, and as few lines as possible, Its 150 now. Yes, the code is messy, and I have a few very long strings of codes that are not exactly pleasing to look at, but it does the job well.

The macros were hard. Particularly in a singe function (One of my aims), But i've included all the PSPad ones and a few more, here is a list, and their values:


c - The date and time in a standard dd/mm/yy hh:mm

d, dd - The day of the month without/with a leading zero.

ddd - The 3-letter abbreviated day name.

dddd - The full day name.

m, mm - The month number without/with a leading zero.

mmm - The 3-letter abbreviated month name.

mmmm - The full month name.

yy, yyyy - The year With/Without the century


h, hh - Hours past midnight without/with a leading zero.

hhh, hhhh - Hours in 12 hour format With/Without a leading 0

n,nn - Minutes past the hour without/with a leading zero.

s, ss - Seconds past the minute without/with a leading zero.

t - time in format hh:mm

tt - time in format hh:mm:ss

am/pm - shows am or pm. UPPERCASE

ap - shows a or p. lowercase

a/p - shows a or p. UPPERCASE

ampm - shows am or pm. lowercase

In addition I have also added:

GMT - The current timezone (Or GGG)

UNIX - the unix timestamp. (Also accepts XXXX)

RFC - ddd, d mmmm yyyy hh:nn:ss GMT (RRR)

You can also include literal strings by enclosing them inside ' ' (Single only at the moment)

EG. 'Last updated on' c

= Last updated on 20/05/2009 18:48:45

My workaround is less than reasonable, and is pretty dodgy, but ah well. Hope it could be useful!

Download Link

Downloads so far are shown on the download page.


Updated download link @ 12 March 2010

Edited by Mat

Share this post

Link to post
Share on other sites

A shameful yet necessary bump on bang on 24h. :)

I was looking for ways to improve this, getting 30 views is not good, and This script does need some solid advice to get it working properly like I want it to.

I hate to bump my own script, but I feel it is needed.


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
Sign in to follow this