This is a discussion on Get GMT date in javascript within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi, Can anyone tell me how to get GMT date in javascript? i can get local system time using Javascript...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi, Can anyone tell me how to get GMT date in javascript? i can get local system time using Javascript
__________________ With, J. Jeyaseelan Everything Possible |
| Sponsored Links |
| |||
| Hi, I have found one solution for this HTML Code: <script language="javscript"> var newDate = getGMTDate(); function getGMTDate() { var theDate = new Date(); var timezone = parseInt(theDate.getTimezoneOffset()*60*1000); newdate = new Date(parseInt(theDate.getTime())+ timezone); newdate = newdate.getFullYear()+"-"+(newdate.getMonth()+1)+"-"+newdate.getDate()+" "+newdate.getHours()+":"+newdate.getMinutes()+":"+newdate.getSeconds(); return newdate; } </script>
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| Here i have got some information on Daylight saving time Daylight saving time (DST; also summer time in British English) is the convention of advancing clocks so that afternoons have more daylight and mornings have less. Typically clocks are adjusted forward one hour near the start of spring and are adjusted backward in autumn. Modern DST was first proposed in 1907 by William Willett. Many countries have used it since then; details vary by location and change occasionally.
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| if you want to know more on Daylight saving time click here Daylight saving time - Wikipedia, the free encyclopedia
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| You can use the following equations to calculate when DST starts and ends. The divisions are integer divisions, in which remainders are discarded. "mod" means the remainder when doing integer division, e.g., 20 mod 7 = 6. That is, 20 divided by 7 is 2 and 6/7th (where six is the remainder). With: y = year.
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| Equation For the United States: Begin DST: Sunday April (2+6*y-y/4) mod 7+1 End DST: Sunday October (31-(y*5/4+1) mod 7) Valid for years 1900 to 2006, though DST wasn't adopted until the 1950s-1960s. 2007 and after: Begin DST: Sunday March 14 - (1 + y*5/4) mod 7 End DST: Sunday November 7 - (1 + y*5/4) mod 7;
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| Most of the United States begins Daylight Saving Time at 2:00 a.m. on the second Sunday in March and reverts to standard time on the first Sunday in November. In the U.S., each time zone switches at a different time. In the European Union, Summer Time begins and ends at 1:00 a.m. Universal Time (Greenwich Mean Time). It begins the last Sunday in March and ends the last Sunday in October. In the EU, all time zones change at the same moment.
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| HTML Code: <Script language=javascript> dt1=getDateObject("10/13/2008","/"); dt2=getDateObject("01/01/2006","/"); if(dt1>dt2) alert("dt1 is greater than dt2") else alert("dt1 is less than dt2") function getDateObject(dateString,dateSeperator) { //This function return a date object after accepting //a date string ans dateseparator as arguments var curValue=dateString; var sepChar=dateSeperator; var curPos=0; var cDate,cMonth,cYear; //extract day portion curPos=dateString.indexOf(sepChar); cDate=dateString.substring(0,curPos); //extract month portion endPos=dateString.indexOf(sepChar,curPos+1); cMonth=dateString.substring(curPos+1,endPos); //extract year portion curPos=endPos; endPos=curPos+5; cYear=curValue.substring(curPos+1,endPos); //Create Date Object dtObject=new Date(cYear,cMonth,cDate); return dtObject; } </script>
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| Hi, I need to check whether the current year is leap year or not using javascript. Is there any method to find the leap year like to get TimeZone . Can anyone help me
__________________ Krishnakumar.S Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily |
| |||
| Hi, I think it can help you to find Leap Year HTML Code: <script language="JavaScript">
function checkleapyear(datea)
{
datea = parseInt(datea);
if(datea%4 == 0)
{
if(datea%100 != 0)
{
return true;
}
else
{
if(datea%400 == 0)
return true;
else
return false;
}
}
return false;
}
//# - Call as
checkleapyear(2000);
__________________ With, J. Jeyaseelan Everything Possible |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Convert a date in milliseconds back to a date string | itbarota | HTML, CSS and Javascript Coding Techniques | 2 | 03-03-2008 09:03 PM |
| How can I show the documents last modified date in the format: month, date, year, tim | Pvinothkumar | HTML, CSS and Javascript Coding Techniques | 3 | 12-28-2007 05:58 AM |
| How do I format the Last-Modified date with javascript? | Pvinothkumar | HTML, CSS and Javascript Coding Techniques | 1 | 10-12-2007 11:17 PM |
| How to find the Starting date of week from a particular date | kingmaker | C# Programming | 1 | 08-16-2007 11:25 PM |
| How to convert a date to a globally accepted date format, in DOT NET 2005? | Archer | C# Programming | 1 | 07-25-2007 03:21 AM |