Jump to content
  • 0

Timestamp using Java


dongtac
 Share

Question

Hi

I was hoping someone could help me with creating some javascript. I have no knowledge of it whatsoever but it appears to be the only solution to my problem without using a pop up calendar (which seems to take forever on my pc to come up).

I want a timestamp to be put against all my submissions, but I only want DD/MM/YY recorded, and not DD/MM/YY HH:MM as is currently the set up in caspio. I wish to sort my results by day, but at the minute if I do a sort based on the current timestamp they will sort by day by hour by minute. I want my results to show the best price per day (eg Monday) as opposed to by minute the data was entered.

I have tried to amend the sample javascript given in the tutorial but I am not having much success. Can anyone give me a helping hand?

This was my last attempt (please don't laugh):- (my timestamp field is called "date", and it is an update datapage)

 

//(1) Declaration and initialization

Stamp = new Date();

var v_TimeStamp;

//(2) Construct the value of the v_TimeStamp variable in the format mm/dd/yyyy

v_TimeStamp=('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getFullYear();

//(3) Field name - Date is referred with a prefix - EditRecord

document.forms[0].UpdateDate.value=v_TimeStamp;

 

Any help is greatly appreciated.

Thanks

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

Hello dongtac,

Have you considered to use Timestamp data type within your table?

http://howto.caspio.com/tech-tips-and-articles/common-customizations/stamp-the-time-url-or-ip-address-to-new-and-updated-records/

You can define date formatting in field advanced section in Datapage wizard:

http://howto.caspio.com/localizations/formatting-options/

Hope this helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...