Various ways to show a Date field

Find your favorite way to show a Date field by looking at the following image:

markdown22.1

 

In order to achieve this, just copy paste one of the following Javascripts in a Calculation field.

1) moment(@Date).tz(“Europe/Copenhagen”).format(“dddd DD/MM/YYYY, hh:mm A”)

2) moment(@Date).tz(“Europe/Copenhagen“).format(“ddd DD/MM/YYYY, hh:mm A”)

3) moment(@Date).tz(“Europe/Copenhagen“).format(“ddd DD/MM/YYYY, HH:mm”)

4) moment(@Date).tz(“Europe/Copenhagen“).format(“ddd DD/MM/YYYY”)

5) moment(@Date).tz(“Europe/Copenhagen“).format(“DD/MM/YYYY hh:mm A”)

6) moment(@Date).tz(“Europe/Copenhagen“).format(“DD/MM/YYYY”)

 

Make sure you replace the @Date with your app’s Date field. Another thing to do is replace “Europe/Copenhagen” with your area time zone.

Where can you find the time zone?  The easiest way to find the timezone name at the end of this page:

http://momentjs.com/timezone/

Here is how to do it:

markdown22.2

 

 

Q: I want to use one of the previous formats but with dots instead of slashes. Can I do that?

A: Yes. You can either use dots or dashes instead of slashes, just replace slashes with what you prefer in the Javascript part of ” DD/MM/YYYY”. So then it will become either “DD.MM.YYYY” or “DD-MM-YYYY”

 

Q: Can I use the American format? 

A: Yes. Here you are. Find your favorite way to show in the image below:

markdown22.3

 

Copy paste one of the following Javascripts in a Calculation field.

1) moment(@Date).tz(“Europe/Copenhagen“).format(“MMMM DD, YYYY”)

2) moment(@Date).tz(“Europe/Copenhagen“).format(“MMM DD, YYYY”)

3) moment(@Date).tz(“Europe/Copenhagen“).format(“MMMM DD, YYYY, hh:mm A”)

4) moment(@Date).tz(“Europe/Copenhagen“).format(“MMMM DD, YYYY, HH:mm”)

5) moment(@Date).tz(“Europe/Copenhagen“).format(“ddd MMMM DD, YYYY, hh:mm A”)

Don’t forget to replace @Date field with your app’s Date field, and also replace “Europe/Copenhagen” with your local timezone name.

 

Q: What happens if I only want to show time out of a Date field?

A: That is also possible. There are two ways of doing that:

markdown22.4

Copy paste one of the following Javascripts in a Calculation field.

1) moment(@Date).tz(“Europe/Copenhagen“).format(“HH:mm”)

2) moment(@Date).tz(“Europe/Copenhagen“).format(“hh:mm A”)

Don’t forget to replace @Date field with your app’s Date field, and also replace “Europe/Copenhagen” with your local timezone name.

 

 

, , , ,

No comments yet.

Leave a Reply