The CreatorCon Call for Content is officially open! Get started here.

Change Date Time Format

ravi154
Giga Contributor

Hi,
If i have a specific format of date in my profile link of service now the system shows all the date formats based on that
Not in the system default format
how to change it back to default format by some script without changing the my profile format ?
example : mm-dd-yyyy -> yyyy-mm-dd

4 REPLIES 4

Not applicable

I'm not sure I really follow where you're trying to go with the value, but if the user profile (sys_user) record date_format is null then it will use the system one instead.

So you can reset a sys_user record back to using the default by assigning '' (the empty string).

(That will take effect next time the user creates a new session, typically by logging out and back in, or next time they log in.)


ravi154
Giga Contributor

first of all thanks for the reply
well let me explain a bit about the scenario
in the user form of our service now instance ( it might be hidden in oob which is available in my profile link ) there is a drop down where one can choose the date format out of 5 available
now if one has something specific - the service now will always show all the dates ( glide date time field ) fields with the specified format
i want to change that format to default system format for some date fields not all ;
so one way as far i see it would be - get the format of that user -> fetch the date value accordingly and reformat it with the system format and set the value again
i would like to know if there is any other way of doing this
hope i am clear to all
thanks


Not applicable


ravi


I don't believe you can. Dates are always formatted with whatever date format is associated with your session, and that value comes from your user profile or the system date format if your profile doesn't have a specific one set.

As far as I know/as far as I can see there is not, in any Form or List view anyway, a way to pick a specific date format per date field. I think you would have to create a custom string field and put your required format of date string in that field, and show that field instead. But obviously that isn't then editable as a date/time field.