Display The ServerTime In Four Different Time Zones With JScript?
Nov 28, 2010
I am adding a custom header to a SharePoint master page and I would like to display the current time in four different time zones. However, I don't want to use the client's time as there is no way to know what time zone the client will be in, or if they have the correct time on their computer.
Ideally, the time should be displayed as follows:
Dallas: (UTC-6 w/ DST support) Zulu: (UTC) Iraq: (UTC+3) Afghanistan: (UTC+4.5)
My problem is that I really don't know anything about ASP.NET, as I'm a PHP guy myself. So I need a way to pass the serverTime as a variable that JavaScript can use to perform calculations on to display the correct time zone.
UPDATE:
I need the clock to update as each second changes. So it is a live time instead of a static time.
UPDATE 2:
This is the code I'm using.
<script runat="server">
Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
End Sub
Public Function dtBase() As Double
Dim d1 As Date = New Date(1970, 1, 1)
[Code]....
UPDATE 3:
Still don't know if the code worked. My SharePoint server rejected the page for the code blocks. I have absolutely zero idea how to do code-behind. The JS works, but if the client's time is off, the site displays incorrect times. Really wish I could just code this in PHP. I'd be done a week ago. ;)
UPDATE 4:
This update is for anyone that stumbles across this in the future looking for the answer to the problem. The code above has been updated to work correctly. The only catch is that SharePoint disallows code by default, so to enable it, you have to modify the web.config file. The web.config file is usually in the root directory of the site. Inside that file (which is XML), you'll find a tag. Somehwere inside of that, you should find , and inside of that, you should find . Inside of that tag, you want to add this:
<PageParserPath VirtualPath="/relative/path/to/your/file/here.aspx" CompilationMode="Always" AllowServerSideScript="true" />
View 3 Replies
Similar Messages:
Apr 18, 2010
I'm having an issue working out how to implement this time based event. Basically, my program needs to send out an email at 12AM monday morning. But the email needs to go based on the user's local time not 12AM server time.
the problem i have discovered is Daylight savings. I used current server time as 12:00AM (my local time) and my actual offset is -7:00 UTC but after the calculation i get -6:00 utc because of daylight savings. If a user was in -7:00UTC then he/she will not get the email at 12am localtime but an hour late.
View 2 Replies
Mar 15, 2010
I am trying to create an app which shows current time in 6 time zones (Sydney, S'pore, india, london, EST and CST).
I am having troubles handling DST, because DST starts and ends on different dates in different countries.
More over I want to make it configurable (add/remove cities from the list).
Currently I have added the cities in .config with their timezone differences (with respect to GMT).
[code]....
View 3 Replies
Aug 16, 2010
I got this answer from Kjensen and read the answers, but this is a different webapp
I'm running scheduled events that process incoming orders, set Picking material, manage Track & Trace numbers, etc ... and I do this at a specific time of the day (set in Administration Panel)
My server is in UK (DiscountAsp.net) but I'm 2 hours ahead.
What I really wanted is, every time I call DateTime.Now that would be automatically changed to my time instead of Local Server Time. This should handle Daylight savings as well.
I thought about making a Extension to simply call DateTime.MyLocalTime and there use TimeInfo to add / subtract the correct hours.
In good old days I did this in Global.asa (ASP) ... I just wanted to know if there is a better way to handle this.
View 1 Replies
Apr 2, 2010
I have the code:
[Code]....
[Code]....
I live in Saint-Petersburg, so s="11 : 15 : 14". What should i write in web.config or in some else place for take the similar hours?
I can't to use ToString, ToUniversalTime and change Parse arguments (it data takes from web services).
View 6 Replies
Dec 23, 2013
I need to do to the following:
Find if the current time falls within hourly ranges and display the start hour and end hour of that range in labels.
Examples:
If the current time is 8:46am, label startTime would return "8am" and label endTime would return "9am"
If the current time is 10:01pm, label startTime returns "10pm" and label endTime returns "11pm"
If the current time is 12:59am, label startTime returns "12am" and label endTime returns "1am"
I have been working with the C# TimeRange class but not getting what I need.
View 1 Replies
Aug 4, 2010
I am using ASP.NET 2.0 and C#.
I have a html table, which has 2 rows and 2 columns.
I want to create web part zones for these 2 rows and 2 columns.
For each td, i want a web part zone, so that users can move data across the table.
How to create web part zones for the td?
View 2 Replies
Apr 26, 2010
We have a generic site which we deploy to clients and they personalise the text using the web parts. The problem we are currently experiencing is that they are unable to move web-parts between zones. This is not a JS issue as no errors are being thrown and this is not a CSS issue either, as we re-deployed the website here on our own server and it works perfectly fine. On our client's site, we can drag parts around in the zone it is in, however when we try to move a part out of that zone, we are given a circle cursor with a line through it. Adding parts to a zone is not an issue.
This could perhaps be linked to a previous issue of being unable to view any editable parts of a webpart. I resolved this by removing all the WebPersonalization from the WebPersonalization table in our MSSQL database.
View 2 Replies
Jan 12, 2011
I would like to achieve a nice smooth transition when the user moves controls between the WebPartZones similar to how iGoogle implements it. I've not yet been able to achieve this - the transition is very jumpy and not very smooth (I cannot use SilverLight).
Has anybody achieved this using WepPartZones without the use of SilverLight?
View 1 Replies
Feb 25, 2010
I have a WebPartZone in each of two adjacent columns. There is a gap of about 4 pixels between the two columns that I cannot remove.
I have two zones with the following markup:
[Code]....
On running the page, the relevant source code is:
<%-- End of contents and div containers for Column 1 Zone --%>
...jText at the end of this Webpart.</span>
</td></tr></tbody></table>
</td></tr></table>
</td></tr>
<tr>td style="padding:0;height:100%;"></td>
</tr></table>
</td></tr></table>
</div>
</div>
<%-- Start of div containers for Column 2 Zone --%>
<div id="ctl00_Main_MainCol2" class="box33" style="Width:39.9%;">
<div id="ctl00_Main_MainCol2Con" style="width:auto; margin-left:0.0em; margin-right:0.0em;">
<table cellspacing="0" cellpadding="0" border="0" id="ctl00_Main_ZoneCol2">
<tr><td style="height:100%;">
<%-- The following 2 tables both have cellpadding="2" which appears to be causing the problem --%>
<table cellspacing="0" cellpadding="2" border="0" style="width:100%;height:100%;">
<tr><td>
<table cellspacing="0" cellpadding="2" border="0" id="WebPart_wp1787670866" style="width:100%;">
<tr><td cellpadding="0" style="padding:0px;">
<div id="ctl00_Header_WebPartManager1_wp1787670866"></div>
<%-- Start of contents of Column 2 Zone --%>
<table cellspacing="0" cellpadding="10" style="border: thin solid #000000; background-color: #8db3e2; width:
100%;">
<thead>
</thead>
<tbody>
<tr>
<td><span style="font-size: 12px;">Text at the beginning of this WebPart....
Two of the tables, which I think are rendered by the WebPartZones, have cellpadding="2". This seems to be giving the 4 pixel gap between the columns.
View 2 Replies
Jan 17, 2010
<asp:TextBox
id="txtFromDate"
runat="server"
CssClass="TextBox"
MaxLength="10"
Width="100px"></asp:TextBox>
I have an asp.net web page and i would like to display the system date, on the first time page display?
Can this be done in asp.net or must it be passed from C# or is it a Javascript type thing.
Also can you 'Set InitalValue = "2010-01-01" in the above statement?
View 6 Replies
Feb 20, 2011
How to keep the image transparent zones with WebImage require?
I saw that this function may require an image from a data base or from a file.
[Code]....
But when I call the image, the transparent parts changed to black.
Is there any way to keep the transparent areas of the image?
How would showing the picture in real size?
View 6 Replies
Mar 2, 2011
need to insert huge data into a local SQL server table from remote SQL server every day.I need to create a project to display how many minutes left while inserting based on table size and network speed.Can someone give an idea of how to do it?
View 5 Replies
Mar 11, 2010
I have 2 lines in a text file like this
empid Name Salary Year
1234Johnny Wright 100002009
2344Travis Frank 302002009
For ex : my errors are in empid.. 2 empid's have alphabets which has error.
I m able to display only one error at a time. either 1st or 2nd.
How to display both errors at a time.?
View 2 Replies
Jan 16, 2010
I am developing an application using Asp.Net.My question is whether there is any solution to display a page only for the first time.i.e when the user logs in for the first time it should ask to change the password but when the user logs in after changing the password it should not display the changepassword page instead it should redirect to another page.I have used session variables to do this but after the session expires its again showing the change password page.
View 3 Replies
May 7, 2010
I want to display in a panel at run time different controls, depending on the menu selection.
View 5 Replies
Nov 29, 2010
I am trying to fetch data like Amazon or other sites. The process take time (about one or more hours) to fetch data. But in between the browser get off saying 'Page can not be displayed' in IE and other error in FF and all UI got lost. How to increase browser time to complete the task successfully.
View 1 Replies
May 6, 2010
how to display the All countries date and time in C# I have one dropdown list and one label and one submit button in DropDown list i have add all countries list like GMT + 05:30 Chennai, Kolkata, Mumbai, New Delhiwhen i select the particular list and press submit button to display.
View 3 Replies
Dec 13, 2010
I created the form in which i am showing count down time in label.
below is the code
[Code]....
Even i show the time in various format means Hour, Seconds, Tick but difficulty is that i want to show time in "hh:mm:ss" format & Time in label will be decreasing.
View 7 Replies
May 25, 2010
I am having following value, I want to display only time value in 24 hours format,let me know how can I do this?
DateTime StartDate = DateTime.Parse(item["Start Date"].ToString());
View 4 Replies
Apr 8, 2010
in my project i want to display the previous 5 log in date and time. how to maintain the data for it and achieve the same.
View 3 Replies
Feb 8, 2010
in my application i want to display the duration time of the video ( that is time of the video) in asp.net
View 2 Replies
Dec 13, 2010
i have a problem with this line of code:
Last Visted On :
<%# Eval("LastActivityDate").Now().ToString()%>
I want the time the visitor last visited the website to appear using this code but i am getting this error message:
Error 3 Option Strict On disallows late binding.
View 1 Replies
Apr 3, 2012
I am having two text box for "Password" and "confirm password".
The password should be minimum of 6 charecters.
when the password is minimum of 6 charecter it shows a error message and when the confirm password and password is not matching it shows the error message.
It displays both the error message at a time.
Is there is way to display one by one.
I am using following regular expression validater to validate for minimum of 6 charecter
" <asp:RegularExpressionValidator ValidationGroup="vgProductDetails" ValidationExpression="^([a-zA-Z0-9]{6,10})$" ErrorMessage="Password Should be minimum of 6 Characters and maximum of 8 characters." SetFocusOnError="true" ControlToValidate="txtPassword" ID="RegularExpressionValidator4" runat="server"></asp:RegularExpressionValidator>"
For comapring the password and confirm password, i am using the following.
"<asp:CompareValidator SetFocusOnError="true" ID="CompareValidator2" runat="server" ControlToValidate="txtconfirmPassword" ControlToCompare="txtPassword" ErrorMessage="Password and confirm password should be same."></asp:CompareValidator>"
View 1 Replies
Apr 19, 2012
I am having 3 lable and i need to display in following format
lbl1.text= Fri 4/20 (Today) =>should display the Today's date in the following format
lbl2.text= Thu 4/19 (Yesterday)=> display the yesterday date.
lbl3.text = Wed 4/18= >Day before yesterday .
View 1 Replies