Skip to content

Timezone Conversion

Robin Rodricks edited this page Oct 12, 2020 · 17 revisions

API

Settings

  • TimeConversion - Server timestamps are converted into the given timezone. You need to set the other properties for this to work. Default: FtpDate.ServerTime.

    • FtpDate.ServerTime will return the original timestamp.
    • FtpDate.LocalTime will convert the timestamp into your local machine's timezone.
    • FtpDate.UTC will convert the timestamp into UTC format (GMT+0).
  • TimeZone - The timezone of the FTP server. If the server is in Tokyo with UTC+9 then set this to 9. If the server returns timestamps in UTC then keep this 0. Default: 0. Range: -14 to 14 to represent UTC-14 to UTC+14.

  • LocalTimeZone (.NET core only) - The timezone of your machine. If your machine is in Tokyo with UTC+9 then set this to 9. If your machine is synchronized with UTC then keep this 0. Default: 0. Range: -14 to 14 to represent UTC-14 to UTC+14.

Utilities

  • ParseFtpDate - Converts the FTP date string into a DateTime object, honoring the timezone conversion configuration. In most cases you will never need to use this directly.

  • GenerateFtpDate - Generates an FTP date-string from the DateTime object, reversing the timezone conversion configuration. In most cases you will never need to use this directly.

FAQs

How do I set the TimeZone and LocalTimeZone properties?

You need to set it based on your timezone's offset from UTC/GMT. So if you are in Tokyo with UTC+9 then set this to 9.

See the image below for the values you need to set it to: (it will accept any value in the range of -14 to 14)

How do I retrieve date/time values in UTC?

Set the server's timezone into TimeZone and then set TimeConversion = FtpDate.UTC

How do I retrieve date/time values in my local timezone?

Set the server's timezone into TimeZone and then set TimeConversion = FtpDate.LocalTime

For .NET Core/.NET Standard users: You need to set LocalTimeZone with the timezone of your machine.

Clone this wiki locally