Skip to main content
Tweeted twitter.com/StackCodeGolf/status/775215948383064064
added 22 characters in body
Source Link
Beta Decay
  • 23.4k
  • 8
  • 72
  • 165

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

The hours in your output doesdo not have to be padded wih zeroes but your time it must be in 24 hour format

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 15:27

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

The timezone will be in the range UTC-24:00 to UTC+24:00 inclusive.

In the case of half past midnight, the correct representation should be 00:30, not 24:30.

Winning

The shortest code in bytes wins.

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

The output does not have to be padded wih zeroes but it must be in 24 hour format

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 15:27

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

The timezone will be in the range UTC-24:00 to UTC+24:00 inclusive.

In the case of half past midnight, the correct representation should be 00:30, not 24:30.

Winning

The shortest code in bytes wins.

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

The hours in your output do not have to be padded wih zeroes but your time it must be in 24 hour format

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 15:27

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

The timezone will be in the range UTC-24:00 to UTC+24:00 inclusive.

In the case of half past midnight, the correct representation should be 00:30, not 24:30.

Winning

The shortest code in bytes wins.

added 180 characters in body
Source Link
Beta Decay
  • 23.4k
  • 8
  • 72
  • 165

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

The output does not have to be padded wih zeroes but it must be in 24 hour format

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 1415:1627

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

The timezone will be in the range UTC-24:00 to UTC+24:00 inclusive.

In the case of half past midnight, the correct representation should be 00:30, not 24:30.

Winning

The shortest code in bytes wins.

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

The output does not have to be padded wih zeroes but it must be in 24 hour format

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 14:16

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

Winning

The shortest code in bytes wins.

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

The output does not have to be padded wih zeroes but it must be in 24 hour format

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 15:27

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

The timezone will be in the range UTC-24:00 to UTC+24:00 inclusive.

In the case of half past midnight, the correct representation should be 00:30, not 24:30.

Winning

The shortest code in bytes wins.

added 87 characters in body
Source Link
Beta Decay
  • 23.4k
  • 8
  • 72
  • 165

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

The output does not have to be padded wih zeroes but it must be in 24 hour format

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 14:16

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

Winning

The shortest code in bytes wins.

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 14:16

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

Winning

The shortest code in bytes wins.

Challenge

Given a time and a timezone as input, output the time in that timezone.

Time

The time will be given in 24 hour format like so:

hh:mm

Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so:

06:09

All the times given are at UTC+00:00.

The output does not have to be padded wih zeroes but it must be in 24 hour format

Timezone

The timezone will be given in the following format:

UTC±hh:mm

Where ± is either going to be a + or a - and hh, is the two digit hour and mm is the two digit minute (again, these will be padded with zeroes).

To find the time in that timezone, you either add (if the symbol is +) or subtract (if the symbol is -) the time after the UTC± from the inputted time.

For example, if the input was 24:56 and UTC-02:50, you would subtract 2 hours and 50 minutes from 24:56:

24:56
02:50 -
-----
22:06

The output would be 22:06.

Examples

Chicago

Input:  08:50 and UTC-06:00
Output: 02:50

Kathmandu

Input:  09:42 and UTC+05:45
Output: 14:16

Samoa

Input:  06:42 and UTC+13:00
Output: 19:42

Hawaii

Input:  02:40 and UTC-10:00
Output: 16:40

Note that this has gone to the previous day.

Tokyo

Input:  17:25 and UTC+09:00
Output: 02:25

Note that this has gone to the following day.

Rules

You must not use any built in date functions or libraries.

Assume all input will be valid times and time offsets.

Winning

The shortest code in bytes wins.

added 71 characters in body
Source Link
Beta Decay
  • 23.4k
  • 8
  • 72
  • 165
Loading
Source Link
Beta Decay
  • 23.4k
  • 8
  • 72
  • 165
Loading