Answers for "datetime change format"

0

python change format of datetime

now = datetime.now()
time_string = now.strftime("%Y-%m-%d %H:%M:%S")
print(time_string)
Posted by: Guest on July-11-2021
0

DateTimeField change format

class UserSerializer(serializers.ModelSerializer):
   date_joined = serializers.DateTimeField(format="<Your format>")

class Meta:
    model = User
    fields = ('username', 'email', 'first_name', 'last_name', 'is_superuser', 'is_staff', 'is_active','get_absolute_url')
Posted by: Guest on September-07-2020

Code answers related to "datetime change format"

Python Answers by Framework

Browse Popular Code Answers by Language