onchange event- UTC format for Date

  I am using a picklist onchange event to change the date of another field.
Date value is in the format of 'mm/dd/yyyy' in the script.
But It's a format of returnValue field which takes UTC format.
I tried Date.toUTCString() function but it did not work either.

Can anyone tell me how to correctly format UTC date. If there is any 
function availabe please let me know.

I will greatly appreciate help.

thanks,

0
Utf
8/24/2005 5:19:03 PM
crm 35858 articles. 1 followers. Follow

1 Replies
832 Views

Similar Articles

[PageSpeed] 11

One of my friend (Tim Darius) helped me giving the following code snippet:

======================
/* When a Case Type is selected, default the followupby date field to
today - provided it hasn't already been populated. */
/* Build the display date in the form of mm/dd/yyyy; Build the return
value in UTC form */
/* cd = current date; s= string; dp = date part; r = return value */
var cd, s, dp;
s = crmForm.followupby.value;
if (s.length == 0)
{
  cd = new Date();
  dp = "00" + (cd.getMonth() + 1);
  s = dp.substr(dp.length-2,2) + "/";
  dp = "00" + (cd.getDate());
  s += dp.substr(dp.length-2,2) + "/" + cd.getYear();
  crmForm.followupby.value = FormatDate(ParseDate(s));
  crmForm.followupby.returnValue = FormatUtcDate(ParseDate(s));
  crmForm.followupby.click();
}
=====================

The FormatDate and FormatUTCDate functions are NOT native JScript commands.
Assuming your CRM server's web root is c:\inetpub, these functions (and 
others) are defined in c:\inetput\wwwroot\_controls\datetime\date.js

These scripts were provided to you with the CRM installation and are
referenced within the CRM pages themselves.

To demonstrate this - open an existing case, then press ctrl+n to launch
a new browser window from the current browser window - which contains
the browser's address bar, navigation bar, etc.

Select the View menu - then select Source - and in the <head> section
of the HTML, you'll find this line:

<script language="javascript"
src="/_controls/datetime/date.js"></script>


When the onChange event is fired within a picklist - you can only write
the body of the single function that executes in response to that
change event ... but your function can make use of any other function that is
included within the page!

Thanks a lot to Tim. 

regards
Muhammad


"Muhammad" wrote:

>   I am using a picklist onchange event to change the date of another field.
> Date value is in the format of 'mm/dd/yyyy' in the script.
> But It's a format of returnValue field which takes UTC format.
> I tried Date.toUTCString() function but it did not work either.
> 
> Can anyone tell me how to correctly format UTC date. If there is any 
> function availabe please let me know.
> 
> I will greatly appreciate help.
> 
> thanks,
> 
0
Utf
8/25/2005 3:16:14 PM
Reply:

Similar Artilces:

Word 2004 formatting
For some reason Word now opens my documents in a defined space in the center of my monitor. I can enlarge the image (ie, 150%) but the defined space doesn't change size so I lose text. Changing from Normal, to Page Layout, etc doesn't fix the problem. What's wrong and how do I fix it? Many thanks! Jim When you hit the green button in the top left, what happens? When you drag the bottom right corner, what happens? On 18/2/07 1:28 PM, in article 1171765694.927622.224610@t69g2000cwt.googlegroups.com, "jb_powell@qwest.net" <jb_powell@qwest.net> wrote: > For som...

Dates in Formulae
Dear all, Suppose I want to create a basic formula eg one which adds 6 months to a date, how would I do it? Doing it by date + 6 months worth of days will obviously not work as the number of days in 6 months will vary. Any thoughts? Thanks, Danny Hi Danny, =DATE(YEAR(A1),MONTH(A1)+6,DAY(A1)) But do think about what you want the day to be in case the source date is, for example, august 31. -- Kind Regards, Niek Otten Microsoft MVP - Excel "Aardvark" <djurmann@hotmail.com> wrote in message news:%23cU8IWF0DHA.2580@TK2MSFTNGP09.phx.gbl... > Dear all, > > ...

Auto fill cells with dates, exclude weekends?
What I'm doing is filling in multiple cells with dates (by dragging and filling) automatically. I was wondering if there was anyway for it to skip the weekends within the dates? Thanks in advance. Hi Sam rather than dragging with the left mouse button down, drag with the right .... when you let go you'll see an option for fill weekdays. Cheers JulieD "Sam Weber" <sam@hostradius.com> wrote in message news:af3901c4796d$85dff660$a501280a@phx.gbl... > What I'm doing is filling in multiple cells with dates > (by dragging and filling) automatically. I was wo...

Displaying Message from event sink to Edit control in dialog box
Hai I am working on FTP Software using MFC and i have to write the ftp server request and response to tracer window. The server request and response were caught by Eventsink and i donot know how to pass this text to edit control in dialog box which is another class. Here is coding of Event Sink / EventSink.cpp : implementation file // #include "stdafx.h" #include "RoboFTPClient.h" #include "RoboFTPClientDlg.h" #include "Eventsink.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern long gnResult...

Captions and Citations won't format differently on same line.
Sir/Ma'am, Here's my issue: I have several figures in my document, which I have captioned using the "caption" command. Additionally, I have given the source for the caption as well. For instance: "Figure 1: Elm Tree (Jones, 2007)." I have created a Table of Figures, and the table of figures views the citation as part of the caption. When I try to select the citation and change it to normal text style (so the table of figures won't recognize it as captioned text) it will not let me change it if it is on the same line. My style book requ...

Converting a Date
I have a column with dates in the format mm/dd/yyyy. I would like to have an additional column the will give me only the month and another only the year, all from the above date column Pls Advise. Thankyou. Do not store the month and year in other columns. Instead extract the month and years using the Month() and Year() functions. They will give you number of both. For example today (March 19, 2010) will show up as 3 for the month. If you need to see March instead of 3, use the Format Function something like below: Format([TheDateColumn], "MMMM") -- Jerry Whi...

Date Changes to 01/00/00 when i enter any date.
Using XL2003, I have a problem. When i enter a date in cell, such as 08/25/10, or use the shortcut Ctrl ;, XL displays 01/00/00 in the cell instead. I have formatted the cell as a date. What can I do to fix this problem? Thank you so much. Tonso ...

Create Formula
I need to create a formula where I add a set number of Networkdays to a start date. Example: Start Date = 1/2/07 Number of Networkdays = 21 End Date = Is calculated If Start = 1/2/07 and 21 Networkdays are added, what is the retured end date???? I can only find example of Networkdays where I would be providing the Start and End Dates, and it will calculate the Networkdays. I can't find example where End Date is calculated based on the number of networkdays from start date. Can anyone help with a valid formula for this? Thanks!! ...

Contract Date Issue
Basically, you create a contract normally. However, when you go to add a contract line, you get a date error. Apparently, the system thinks that the contract line start and/or end dates are outside the contract start and end dates, even though the contract line defaults to the using the contract start and end dates (i.e. the dates on the line match those on the contract). I know this must be a data type issue with the datetime values. Has anyone else had this problem? Is there a fix? On Mon, 31 Oct 2005 15:08:14 -0500, "Tim Powers" <tim.powers@rimrock.com> wrote: ...

Activity without date
In my current project plan I know a few activities that will be conducted, more specifically meetings that are important. Now, I don't know the date they will happen yet and I want to indicate that by adding the activity but not entering a date. Is that allowed in MS Project? Since Project is designed to calculate dates, not only can you enter a task without a date, you should be entering ALL tasks without dates and then Project tells you when you should schedule them. -- Steve House MS Project Trainer & Consultant "Hertsh" <Hertsh@discussions.microsoft....

Archiving broke
Outlook is not archiving most of my deleted and sent items. Yes, I've read about making sure the modification date is within range as well as making sure these folders are set to archive. THE SETTINGS ARE CORRECT. I heard somewhere that if the msgs modification date is "none", then Outlook interprets this a 1/1/4501 (and empty date) and therefore things don't get archived (my deleted and sent items). Anyone heard if this is true...and if so, is there a workaround?????? Amil Why are you keeping deleted items? If you need to keep them they should be in a specific Folder...

Using SUMIF to add data between a range of dates
Hi, I am developing a cashflow spreadsheet, and need to add a range of values (in column B) based on the criteria that they are relating to a set week, ie in column B has the amount to be paid, and column C has the date the amount is due. I need to find out the total amount due between 2 dates. Does anyone know how I can do this? Hi With start date in B20 and end date in B21 try this: =SUMIF(C2:C5,">=" &B20,B2:B5)-SUMIF(C2:C5,"<="&B21,B2:B5) Regards, Per "Jaspa" <Jaspa@discussions.microsoft.com> skrev i meddelelsen news...

Excel importing dates from a RTF in a macro
If I open a RTF with a date in, the date appears as it does in the original RTF. If however, if I run Office 2000 and record the above event using a macro, when played the date swaps the mm and dd round (without changing the properties, so in fact the mm is now the dd and the dd is now the mm) This only occurs if the dd is 12 or below in value for obvious reasons. I then tried to open the RTF date column as text, and then change the column properties after it is imported. This does work fine, but I am using the Application.Filesearch and am not sure how to integrate the OpenText function whic...

Combining date and time into one cell
I have the date (m/dd/yy) in one cell and time (hh:mm) in another cell. How can I merge these two in one cell with the format m/dd/yy hh:mm ? Thanks. Date in A1, time in B1, combined in C1: formula is =A1+B1 and format as you describe. On Sat, 22 Jan 2005 14:03:02 -0800, "Kelly C" <KellyC@discussions.microsoft.com> wrote: >I have the date (m/dd/yy) in one cell and time (hh:mm) in another cell. How >can I merge these two in one cell with the format m/dd/yy hh:mm ? > >Thanks. =TEXT(A1,"m/dd/yy ")&TEXT(B1,"hh:mm") is one way -- HT...

International date formats
When performing an Edit, replace on the cell value 10.09.03 (a system genereated date vale of 10th Sep 03) replaceing the . with /, Excel (and in VBA when recorded as a macro) sometimes changes the cell value to 09/10/03 (9th October 03). This is driving me potty and have spent a vast amount of time on it trying to work out what Excel is doing!!!! My Regional settings are set fro the UK. Any ideas anyone? "Mike" <michael.may@npower.com> wrote in message news:2d44701c39483$97f77730$a601280a@phx.gbl... > When performing an Edit, replace on the cell value > 10.09.0...

Multple calendars in one user
I am trying to get multiple calendars set up under one user and some of the events would be shared between different ones. I can not find how to essentially invite myself to an event between the different calendars. You are allowed to create the different calendars but you are not allowed to share events between them. Anyone done this before? Create a meeting request in the non-default calendar and invite yourself. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by ...

leading zeros in text format
I receive bulk orders via an Excel spreadsheet, containing many individual orders with reference numbers. The reference numbers may be 7-9 digits long, however the field needs to have 10 digits. The format is set to customize: 0000000000. In this manner, we always see the 10 digits regardless of the actual number. The problem we have is that we bulk-load this spreadsheet through a specific custome built bulk-loader. This reference number field must have 10 actual digits, not format digits. Therefore a number such as 00865243 becomes 865243 and then will not run through the bulk loa...

Event ID 9665
I have been receiving the subject ID (memory settings for this server are not optimal for Exchange) on a Windows 2003 Standard Server that hosts my Exchange Server 2003 AND is also my DC - with a total of 2GB of RAM. The above event refers to Microsoft KB article # 815372 - which, to say the least, is a bit confusing. My questions are this: 1. Should I be using the /3GB and the /USERVA=3030 switches in my boot.ini file? 2. The SystemPages subkey on this server (HKLM\SYSTEM\CurrentControlSet\Session\Manager\MemoryManagement) is 798720 - and I assume that is a system-calculated value. Sho...

downloaded transaction date
There used to be a setting in prior versions of Money to not overwrite your money file with the downloaded transaction dates when matching transactions. Does anybody know how to make that change in Money 2005? I've not had any luck finding it. Thanks. -z I found the setting - tools/settings/online services/uncheck the 'overwrite transactions' box. Cheers, -z "zender" <anonymous@aol.com> wrote in message news:uelFWDVuEHA.2788@TK2MSFTNGP09.phx.gbl... > There used to be a setting in prior versions of Money to not overwrite > your money file with t...

Automatic date editing
Hi When I edit a cell, I would like to know if the last editing date could be shown automaticly next to it example ID Value Last date value was edite Refrigerator $945.00 12/1/200 Thanks... Hi Marcio You can do it with the change event of the worksheet This example will place the date/time in the B column if you change a cell in the range A1:A20. Place the code in the Sheet module Right click on a sheet tab and choose view code Paste the code there Alt-Q to go back to Excel Private Sub Worksheet_Change(ByVal Tar...

Conditional Formatting #28
Hi everybody I use Excel 2002 sp2 Is there a means to have more than 3 conditions for confitional formatting ? the dialog box only features 3. many thanks and best regards Jean Luc J.E. McGimpsey shows a way to get up to 6 different formats using conditional formatting and a custom number format. You can't add more conditions, but you may be able to use a worksheet event that formats the cell the way you want. Jean Luc wrote: > > Hi everybody > > I use Excel 2002 sp2 > Is there a means to have more than 3 conditions for > confitional formatting ? the dialog box ...

Cell Formatting to disp. ### numbers
I am trying to format the cells so that it only allows three numbers t be displayed. To be more descriptive: We work with zip codes quite often, but, we only use the first thre digits. Someone sent us a xls file with 12000 zip codes, in one column, and need to know how to make the column show only the first three digits o all the zip codes.. there is another problem, when I convert them to a numeric value, i removes the zero in front...ex. 08245, becomes 8245, but i need to kee that zero in front. Thanks -Eri -- Message posted from http://www.ExcelForum.com Assuming your zip codes a...

Excel default number format problem
I have a user with an incorrect default cell format in Excel. His default number of decimal places for a cell with numbers is set to 4 instead of 2. I have no idea how he caused this and I have no idea how to correct it. In case I'm being ambiguous, here is the procedure: Open a new Excel workbook, choose any cell and go to Format. In the Format Cell dialog box go to the Number tab and choose the Number category. The Decimal Places box will be set to 2 by default but in this user's Excel it is set to 4. How do I get it back to the default of 2? http://www.imagedump.com/index.cgi?pick...

Serial Dates
Hi everyone, Recently a co-worker came to me with a work sheet that she had been using to track dates that invoices were received. She told me the sheet was working fine one day. The next day, when she entered a date, the cell would only return the serial date no matter how she formatted the cell. The actual date would appear correct in the formula bar, but the cell showed only the serial date. We have tried everything I can think of to get the cells to format to show the date but have not had any success. I finally solved her delima by copying all the data to another new worksheet...

calculate time and date
I want to find out how many houer iy is between one date/time and another date/time. date and time one cell A1= 04.03.2005 08:30 date/time two cell A2= 05.03.2005 23:59 =A2-A1 custom format [hh:mm] or for Norway [tt:mm] -- Regards, Peo Sjoblom "make" <lage@tiscali.no> wrote in message news:2c61523.0503070721.2dacdd07@posting.google.com... > I want to find out how many houer iy is between one date/time and > another date/time. date and time one cell A1= 04.03.2005 08:30 > date/time two cell A2= 05.03.2005 23...