Exemple #1
0
 public string TimeZonePresentation(string id)
 {
     try
     {
         return(TimeZoneConverter.TimeZonePresentation(id));
     }
     catch (TimeZoneNotFoundException)
     {
         throw RuntimeException.InvalidNthArgumentValue(1);
     }
 }
Exemple #2
0
 public int StandardTimeOffset(string timeZone = null, IValue universalTime = null)
 {
     try
     {
         return(TimeZoneConverter.StandardTimeOffset(timeZone, universalTime?.AsDate()));
     }
     catch (TimeZoneNotFoundException)
     {
         throw RuntimeException.InvalidNthArgumentValue(1);
     }
 }
Exemple #3
0
 public IValue ToUniversalTime(IValue localTime, string timeZone = null)
 {
     try
     {
         var dt = TimeZoneConverter.ToUniversalTime(localTime.AsDate(), timeZone);
         return(ValueFactory.Create(dt));
     }
     catch (TimeZoneNotFoundException)
     {
         throw RuntimeException.InvalidNthArgumentValue(2);
     }
 }
Exemple #4
0
 public ArrayImpl GetAvailableTimeZones()
 {
     return(new ArrayImpl(TimeZoneConverter.GetAvailableTimeZones()
                          .Select(x => ValueFactory.Create(x))));
 }
Exemple #5
0
 public string TimeZone()
 {
     return(TimeZoneConverter.TimeZone());
 }