Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / Util / DateTimeUtil.cs / 1 / DateTimeUtil.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Util { using System; internal sealed class DateTimeUtil { private DateTimeUtil() {} const long FileTimeOffset = 504911232000000000; static readonly DateTime MinValuePlusOneDay = DateTime.MinValue.AddDays(1); static readonly DateTime MaxValueMinusOneDay = DateTime.MaxValue.AddDays(-1); static internal DateTime FromFileTimeToUtc(long filetime) { long universalTicks = filetime + FileTimeOffset; return new DateTime(universalTicks); } static internal DateTime ConvertToUniversalTime(DateTime localTime) { if (localTime < MinValuePlusOneDay) { return DateTime.MinValue; } if (localTime > MaxValueMinusOneDay) { return DateTime.MaxValue; } return localTime.ToUniversalTime(); } static internal DateTime ConvertToLocalTime(DateTime utcTime) { if (utcTime < MinValuePlusOneDay) { return DateTime.MinValue; } if (utcTime > MaxValueMinusOneDay) { return DateTime.MaxValue; } return utcTime.ToLocalTime(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Util { using System; internal sealed class DateTimeUtil { private DateTimeUtil() {} const long FileTimeOffset = 504911232000000000; static readonly DateTime MinValuePlusOneDay = DateTime.MinValue.AddDays(1); static readonly DateTime MaxValueMinusOneDay = DateTime.MaxValue.AddDays(-1); static internal DateTime FromFileTimeToUtc(long filetime) { long universalTicks = filetime + FileTimeOffset; return new DateTime(universalTicks); } static internal DateTime ConvertToUniversalTime(DateTime localTime) { if (localTime < MinValuePlusOneDay) { return DateTime.MinValue; } if (localTime > MaxValueMinusOneDay) { return DateTime.MaxValue; } return localTime.ToUniversalTime(); } static internal DateTime ConvertToLocalTime(DateTime utcTime) { if (utcTime < MinValuePlusOneDay) { return DateTime.MinValue; } if (utcTime > MaxValueMinusOneDay) { return DateTime.MaxValue; } return utcTime.ToLocalTime(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TrustManagerPromptUI.cs
- GridViewColumn.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- RolePrincipal.cs
- WebPartChrome.cs
- FileSystemInfo.cs
- Semaphore.cs
- SchemaNames.cs
- EmptyEnumerator.cs
- UpDownBase.cs
- ClientSettingsSection.cs
- Scene3D.cs
- FlowDocumentPageViewerAutomationPeer.cs
- ColorAnimationUsingKeyFrames.cs
- CompilationLock.cs
- MarkerProperties.cs
- RectangleGeometry.cs
- ExecutionContext.cs
- StylusDevice.cs
- ApplicationActivator.cs
- OrderByQueryOptionExpression.cs
- IpcChannelHelper.cs
- EventEntry.cs
- FindCriteriaCD1.cs
- ClosureBinding.cs
- EventSinkHelperWriter.cs
- OutOfMemoryException.cs
- SchemaAttDef.cs
- XmlSchemaInclude.cs
- CaseInsensitiveHashCodeProvider.cs
- StackOverflowException.cs
- UserControlBuildProvider.cs
- MarshalDirectiveException.cs
- SoapIncludeAttribute.cs
- SqlConnectionManager.cs
- IgnorePropertiesAttribute.cs
- ChameleonKey.cs
- XmlNullResolver.cs
- ValidationResult.cs
- EncryptedPackage.cs
- BlobPersonalizationState.cs
- ActiveXSite.cs
- DataGridViewAccessibleObject.cs
- SoapTypeAttribute.cs
- WorkflowRuntime.cs
- SafeBuffer.cs
- ButtonColumn.cs
- FontUnit.cs
- DataObjectMethodAttribute.cs
- StylusPointPropertyInfo.cs
- SchemaNamespaceManager.cs
- EndOfStreamException.cs
- QilScopedVisitor.cs
- CustomAttributeFormatException.cs
- TableStyle.cs
- GridView.cs
- ZipIOExtraField.cs
- _AutoWebProxyScriptHelper.cs
- LowerCaseStringConverter.cs
- GraphicsPathIterator.cs
- WmpBitmapDecoder.cs
- Listbox.cs
- Exceptions.cs
- PersonalizationStateInfoCollection.cs
- InternalConfigRoot.cs
- CodeTypeDelegate.cs
- EntityViewContainer.cs
- TreeNodeEventArgs.cs
- CombinedTcpChannel.cs
- NumericUpDown.cs
- ThemeDirectoryCompiler.cs
- itemelement.cs
- BitmapMetadata.cs
- Debug.cs
- CellCreator.cs
- HttpRawResponse.cs
- CommonObjectSecurity.cs
- _DigestClient.cs
- PieceNameHelper.cs
- MonthChangedEventArgs.cs
- WindowInteractionStateTracker.cs
- XmlSerializer.cs
- WithParamAction.cs
- LoginView.cs
- XPathEmptyIterator.cs
- Section.cs
- UseLicense.cs
- DoubleLink.cs
- MetadataAssemblyHelper.cs
- XsltFunctions.cs
- TextViewBase.cs
- EnumerableRowCollection.cs
- RoleGroupCollection.cs
- DataGridViewImageColumn.cs
- AuthenticationSection.cs
- SystemSounds.cs
- XmlTypeAttribute.cs
- HandlerMappingMemo.cs
- RectAnimationBase.cs
- TextParagraphProperties.cs