Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Setting date field default value to current date.

How can a date field be defaulted to the current date?

This is probably mentioned somewhere in the documentation, but I can't find it.
Is there something that can be placed in the "Default Value" for a form field to set the date to the current date?
Are there other options for this setting other than text or namespace values, and if so - where is it documented?

Everyone's tags (1)
5 REPLIES
New Member

Setting date field default value to current date.

Hi Alan,

We're keen on this too; also looking to be able to do 'relative' dates, so subtract X amount of days from a date field to set Start Dates, etc.  Just posting so we are kept in the loop on the thread!

Thanks,

Ant

New Member

Setting date field default value to current date.

Ditto on needing to know how to do this.

New Member

Setting date field default value to current date.

We got this reply from Leslie - we haven't implemented yet, but will let you know how we go:

The current date is available from both JavaScript and the database.  Perhaps the easiest way to get the current date is to use a SQL-entry data retrieval rule. For example, in Oracle, you could 'select SYSDATE from dual'; the syntax in SQLServer would be 'select getDate()'.  Then distribute the value returned to your field. You will need to be careful that the format in which the item is retrieved (either from JavaScript [ISF] or from the database) is conformable with the display format used for other dates you will be using in your comparison. Each of the databases has functions for manipulating the date format.

 I find manipulating dates easier in the database than in the JavaScript, but a google search on JavaScript date would also turn up examples 

New Member

Setting date field default value to current date.

this is the DDR query we used to get the date:

select convert(varchar(16), getdate(), 103) as date

now we just need to get the date calculation right in javascript :)  this may turn out to be a bit harder for us due to the system default date format of DD/MON/YYYY that we had use being in Australia (and other AUS formats seemed to break things)

New Member

Setting date field default value to current date.

@meghan...Thanks! I ended up doing just that (using a select getdate() as curr_date query).

1210
Views
0
Helpful
5
Replies
CreatePlease to create content